@shadow-garden/bapbong-model 0.13.0 → 0.14.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 +194 -0
- package/dist/index.js +194 -0
- package/dist/lib/model.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -113,6 +113,22 @@ function astToLinear(row) {
|
|
|
113
113
|
const hi = astToLinear(n.hi);
|
|
114
114
|
return n.op + (lo ? sub(lo) : "") + (hi ? sup(hi) : "") + paren(astToLinear(n.body));
|
|
115
115
|
}
|
|
116
|
+
case "func":
|
|
117
|
+
return `${astToLinear(n.name)}\u2061${paren(astToLinear(n.body))}`;
|
|
118
|
+
case "acc":
|
|
119
|
+
return astToLinear(n.body) + n.chr;
|
|
120
|
+
case "lim": {
|
|
121
|
+
const l = astToLinear(n.lim);
|
|
122
|
+
return astToLinear(n.base) + (l ? n.below ? sub(l) : sup(l) : "");
|
|
123
|
+
}
|
|
124
|
+
case "mat": {
|
|
125
|
+
const lines = [];
|
|
126
|
+
for (let i = 0; i < n.cells.length; i += n.cols)
|
|
127
|
+
lines.push(
|
|
128
|
+
n.cells.slice(i, i + n.cols).map((c) => astToLinear(c)).join("&")
|
|
129
|
+
);
|
|
130
|
+
return `(${lines.join("@")})`;
|
|
131
|
+
}
|
|
116
132
|
}
|
|
117
133
|
};
|
|
118
134
|
return row.map(one).join("");
|
|
@@ -133,9 +149,182 @@ function isEqRow(v) {
|
|
|
133
149
|
return typeof n.l === "string" && typeof n.r === "string" && isEqRow(n.body);
|
|
134
150
|
if (t === "big")
|
|
135
151
|
return typeof n.op === "string" && isEqRow(n.lo) && isEqRow(n.hi) && isEqRow(n.body);
|
|
152
|
+
if (t === "func")
|
|
153
|
+
return isEqRow(n.name) && isEqRow(n.body);
|
|
154
|
+
if (t === "acc")
|
|
155
|
+
return typeof n.chr === "string" && isEqRow(n.body);
|
|
156
|
+
if (t === "lim")
|
|
157
|
+
return typeof n.below === "boolean" && isEqRow(n.base) && isEqRow(n.lim);
|
|
158
|
+
if (t === "mat") {
|
|
159
|
+
const m = n;
|
|
160
|
+
return typeof m.cols === "number" && m.cols > 0 && Array.isArray(m.cells) && m.cells.every((c) => isEqRow(c));
|
|
161
|
+
}
|
|
136
162
|
return false;
|
|
137
163
|
});
|
|
138
164
|
}
|
|
165
|
+
var frac = () => ({ t: "frac", num: [], den: [] });
|
|
166
|
+
var scr = (slots) => ({
|
|
167
|
+
t: "scr",
|
|
168
|
+
base: [],
|
|
169
|
+
sub: [],
|
|
170
|
+
sup: [],
|
|
171
|
+
slots
|
|
172
|
+
});
|
|
173
|
+
var rad = (showDeg) => ({
|
|
174
|
+
t: "rad",
|
|
175
|
+
deg: [],
|
|
176
|
+
body: [],
|
|
177
|
+
showDeg
|
|
178
|
+
});
|
|
179
|
+
var fence = (l, r) => ({
|
|
180
|
+
t: "fence",
|
|
181
|
+
l,
|
|
182
|
+
r,
|
|
183
|
+
body: []
|
|
184
|
+
});
|
|
185
|
+
var upright = (s) => [...s].map((ch) => ({ t: "chr", ch }));
|
|
186
|
+
var func = (name) => ({
|
|
187
|
+
t: "func",
|
|
188
|
+
name: upright(name),
|
|
189
|
+
body: []
|
|
190
|
+
});
|
|
191
|
+
var acc = (chr) => ({ t: "acc", chr, body: [] });
|
|
192
|
+
var mat = (rows, cols) => ({
|
|
193
|
+
t: "mat",
|
|
194
|
+
cols,
|
|
195
|
+
cells: Array.from({ length: rows * cols }, () => [])
|
|
196
|
+
});
|
|
197
|
+
var braced = (l, r, rows, cols) => ({
|
|
198
|
+
t: "fence",
|
|
199
|
+
l,
|
|
200
|
+
r,
|
|
201
|
+
body: [mat(rows, cols)]
|
|
202
|
+
});
|
|
203
|
+
var lim = (name, below = true) => ({
|
|
204
|
+
t: "lim",
|
|
205
|
+
base: upright(name),
|
|
206
|
+
lim: [],
|
|
207
|
+
below
|
|
208
|
+
});
|
|
209
|
+
var big = (op, limits = false) => ({
|
|
210
|
+
t: "big",
|
|
211
|
+
op,
|
|
212
|
+
lo: [],
|
|
213
|
+
hi: [],
|
|
214
|
+
body: [],
|
|
215
|
+
showLo: limits,
|
|
216
|
+
showHi: limits
|
|
217
|
+
});
|
|
218
|
+
var EQ_STRUCTURES = [
|
|
219
|
+
{ group: "Fraction", name: "Stacked", node: frac(), focus: ["num"] },
|
|
220
|
+
{ group: "Script", name: "Superscript", node: scr("sup"), focus: ["sup"] },
|
|
221
|
+
{ group: "Script", name: "Subscript", node: scr("sub"), focus: ["sub"] },
|
|
222
|
+
{ group: "Script", name: "Sub and super", node: scr("both"), focus: ["sub"] },
|
|
223
|
+
{ group: "Radical", name: "Square root", node: rad(false), focus: ["body"] },
|
|
224
|
+
{ group: "Radical", name: "Nth root", node: rad(true), focus: ["deg"] },
|
|
225
|
+
{ group: "Integral", name: "Integral", node: big("\u222B"), focus: ["body"] },
|
|
226
|
+
{ group: "Integral", name: "Definite", node: big("\u222B", true), focus: ["lo"] },
|
|
227
|
+
{ group: "Integral", name: "Double", node: big("\u222C"), focus: ["body"] },
|
|
228
|
+
{ group: "Integral", name: "Contour", node: big("\u222E"), focus: ["body"] },
|
|
229
|
+
{
|
|
230
|
+
group: "Large operator",
|
|
231
|
+
name: "Summation",
|
|
232
|
+
node: big("\u2211"),
|
|
233
|
+
focus: ["body"]
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
group: "Large operator",
|
|
237
|
+
name: "Sum with limits",
|
|
238
|
+
node: big("\u2211", true),
|
|
239
|
+
focus: ["lo"]
|
|
240
|
+
},
|
|
241
|
+
{ group: "Large operator", name: "Product", node: big("\u220F"), focus: ["body"] },
|
|
242
|
+
{
|
|
243
|
+
group: "Large operator",
|
|
244
|
+
name: "Product with limits",
|
|
245
|
+
node: big("\u220F", true),
|
|
246
|
+
focus: ["lo"]
|
|
247
|
+
},
|
|
248
|
+
{ group: "Large operator", name: "Union", node: big("\u22C3"), focus: ["body"] },
|
|
249
|
+
{
|
|
250
|
+
group: "Large operator",
|
|
251
|
+
name: "Intersection",
|
|
252
|
+
node: big("\u22C2"),
|
|
253
|
+
focus: ["body"]
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
group: "Bracket",
|
|
257
|
+
name: "Parentheses",
|
|
258
|
+
node: fence("(", ")"),
|
|
259
|
+
focus: ["body"]
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
group: "Bracket",
|
|
263
|
+
name: "Brackets",
|
|
264
|
+
node: fence("[", "]"),
|
|
265
|
+
focus: ["body"]
|
|
266
|
+
},
|
|
267
|
+
{ group: "Bracket", name: "Braces", node: fence("{", "}"), focus: ["body"] },
|
|
268
|
+
{
|
|
269
|
+
group: "Bracket",
|
|
270
|
+
name: "Absolute value",
|
|
271
|
+
node: fence("|", "|"),
|
|
272
|
+
focus: ["body"]
|
|
273
|
+
},
|
|
274
|
+
{ group: "Bracket", name: "Norm", node: fence("\u2016", "\u2016"), focus: ["body"] },
|
|
275
|
+
{ group: "Bracket", name: "Angle", node: fence("\u27E8", "\u27E9"), focus: ["body"] },
|
|
276
|
+
{ group: "Bracket", name: "Floor", node: fence("\u230A", "\u230B"), focus: ["body"] },
|
|
277
|
+
{ group: "Bracket", name: "Ceiling", node: fence("\u2308", "\u2309"), focus: ["body"] },
|
|
278
|
+
{ group: "Function", name: "sin", node: func("sin"), focus: ["body"] },
|
|
279
|
+
{ group: "Function", name: "cos", node: func("cos"), focus: ["body"] },
|
|
280
|
+
{ group: "Function", name: "tan", node: func("tan"), focus: ["body"] },
|
|
281
|
+
{ group: "Function", name: "cot", node: func("cot"), focus: ["body"] },
|
|
282
|
+
{ group: "Function", name: "ln", node: func("ln"), focus: ["body"] },
|
|
283
|
+
{ group: "Function", name: "log", node: func("log"), focus: ["body"] },
|
|
284
|
+
{ group: "Function", name: "exp", node: func("exp"), focus: ["body"] },
|
|
285
|
+
// The name is empty and editable — for anything the list does not carry.
|
|
286
|
+
{ group: "Function", name: "Custom", node: func(""), focus: ["name"] },
|
|
287
|
+
{ group: "Accent", name: "Bar", node: acc("\u0305"), focus: ["body"] },
|
|
288
|
+
{ group: "Accent", name: "Vector", node: acc("\u20D7"), focus: ["body"] },
|
|
289
|
+
{ group: "Accent", name: "Hat", node: acc("\u0302"), focus: ["body"] },
|
|
290
|
+
{ group: "Accent", name: "Tilde", node: acc("\u0303"), focus: ["body"] },
|
|
291
|
+
{ group: "Accent", name: "Dot", node: acc("\u0307"), focus: ["body"] },
|
|
292
|
+
{ group: "Accent", name: "Double dot", node: acc("\u0308"), focus: ["body"] },
|
|
293
|
+
{ group: "Limit", name: "Limit", node: lim("lim"), focus: ["lim"] },
|
|
294
|
+
{ group: "Limit", name: "Maximum", node: lim("max"), focus: ["lim"] },
|
|
295
|
+
{ group: "Limit", name: "Minimum", node: lim("min"), focus: ["lim"] },
|
|
296
|
+
{ group: "Limit", name: "Over", node: lim("", false), focus: ["base"] },
|
|
297
|
+
{ group: "Matrix", name: "1\xD72", node: mat(1, 2), focus: ["c0"] },
|
|
298
|
+
{ group: "Matrix", name: "2\xD71", node: mat(2, 1), focus: ["c0"] },
|
|
299
|
+
{ group: "Matrix", name: "2\xD72", node: mat(2, 2), focus: ["c0"] },
|
|
300
|
+
{ group: "Matrix", name: "3\xD73", node: mat(3, 3), focus: ["c0"] },
|
|
301
|
+
{
|
|
302
|
+
group: "Matrix",
|
|
303
|
+
name: "Bracketed 2\xD72",
|
|
304
|
+
node: braced("[", "]", 2, 2),
|
|
305
|
+
focus: ["body", 0, "c0"]
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
group: "Matrix",
|
|
309
|
+
name: "Determinant 2\xD72",
|
|
310
|
+
node: braced("|", "|", 2, 2),
|
|
311
|
+
focus: ["body", 0, "c0"]
|
|
312
|
+
},
|
|
313
|
+
// Two and three equations under one brace — how a system is set in
|
|
314
|
+
// Vietnamese exam papers, and awkward to build out of the pieces.
|
|
315
|
+
{
|
|
316
|
+
group: "Matrix",
|
|
317
|
+
name: "System of 2",
|
|
318
|
+
node: braced("{", "", 2, 1),
|
|
319
|
+
focus: ["body", 0, "c0"]
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
group: "Matrix",
|
|
323
|
+
name: "System of 3",
|
|
324
|
+
node: braced("{", "", 3, 1),
|
|
325
|
+
focus: ["body", 0, "c0"]
|
|
326
|
+
}
|
|
327
|
+
];
|
|
139
328
|
|
|
140
329
|
// packages/model/src/lib/model.ts
|
|
141
330
|
function dataJson(el, name) {
|
|
@@ -430,6 +619,11 @@ var schema = new import_prosemirror_model.Schema({
|
|
|
430
619
|
// The same equation as an AST (EqNode[]) — what conversion turns
|
|
431
620
|
// into a real 2D equation node. Null when undecodable.
|
|
432
621
|
equationAst: { default: null },
|
|
622
|
+
// `o:OLEObject/@ProgID` when this box is an EMBEDDED OBJECT rather
|
|
623
|
+
// than a picture ("Equation.DSMT4" for MathType). The bitmap is only
|
|
624
|
+
// the object's preview, so the editor offers object tools, not the
|
|
625
|
+
// picture toolkit. Null for real pictures.
|
|
626
|
+
oleProgId: { default: null },
|
|
433
627
|
// w:position on the run holding a legacy object — baseline shift in
|
|
434
628
|
// px, positive UP (same convention as InlineRun.raise). MathType
|
|
435
629
|
// lowers every equation so its baseline meets the text line's.
|
package/dist/index.js
CHANGED
|
@@ -81,6 +81,22 @@ function astToLinear(row) {
|
|
|
81
81
|
const hi = astToLinear(n.hi);
|
|
82
82
|
return n.op + (lo ? sub(lo) : "") + (hi ? sup(hi) : "") + paren(astToLinear(n.body));
|
|
83
83
|
}
|
|
84
|
+
case "func":
|
|
85
|
+
return `${astToLinear(n.name)}\u2061${paren(astToLinear(n.body))}`;
|
|
86
|
+
case "acc":
|
|
87
|
+
return astToLinear(n.body) + n.chr;
|
|
88
|
+
case "lim": {
|
|
89
|
+
const l = astToLinear(n.lim);
|
|
90
|
+
return astToLinear(n.base) + (l ? n.below ? sub(l) : sup(l) : "");
|
|
91
|
+
}
|
|
92
|
+
case "mat": {
|
|
93
|
+
const lines = [];
|
|
94
|
+
for (let i = 0; i < n.cells.length; i += n.cols)
|
|
95
|
+
lines.push(
|
|
96
|
+
n.cells.slice(i, i + n.cols).map((c) => astToLinear(c)).join("&")
|
|
97
|
+
);
|
|
98
|
+
return `(${lines.join("@")})`;
|
|
99
|
+
}
|
|
84
100
|
}
|
|
85
101
|
};
|
|
86
102
|
return row.map(one).join("");
|
|
@@ -101,9 +117,182 @@ function isEqRow(v) {
|
|
|
101
117
|
return typeof n.l === "string" && typeof n.r === "string" && isEqRow(n.body);
|
|
102
118
|
if (t === "big")
|
|
103
119
|
return typeof n.op === "string" && isEqRow(n.lo) && isEqRow(n.hi) && isEqRow(n.body);
|
|
120
|
+
if (t === "func")
|
|
121
|
+
return isEqRow(n.name) && isEqRow(n.body);
|
|
122
|
+
if (t === "acc")
|
|
123
|
+
return typeof n.chr === "string" && isEqRow(n.body);
|
|
124
|
+
if (t === "lim")
|
|
125
|
+
return typeof n.below === "boolean" && isEqRow(n.base) && isEqRow(n.lim);
|
|
126
|
+
if (t === "mat") {
|
|
127
|
+
const m = n;
|
|
128
|
+
return typeof m.cols === "number" && m.cols > 0 && Array.isArray(m.cells) && m.cells.every((c) => isEqRow(c));
|
|
129
|
+
}
|
|
104
130
|
return false;
|
|
105
131
|
});
|
|
106
132
|
}
|
|
133
|
+
var frac = () => ({ t: "frac", num: [], den: [] });
|
|
134
|
+
var scr = (slots) => ({
|
|
135
|
+
t: "scr",
|
|
136
|
+
base: [],
|
|
137
|
+
sub: [],
|
|
138
|
+
sup: [],
|
|
139
|
+
slots
|
|
140
|
+
});
|
|
141
|
+
var rad = (showDeg) => ({
|
|
142
|
+
t: "rad",
|
|
143
|
+
deg: [],
|
|
144
|
+
body: [],
|
|
145
|
+
showDeg
|
|
146
|
+
});
|
|
147
|
+
var fence = (l, r) => ({
|
|
148
|
+
t: "fence",
|
|
149
|
+
l,
|
|
150
|
+
r,
|
|
151
|
+
body: []
|
|
152
|
+
});
|
|
153
|
+
var upright = (s) => [...s].map((ch) => ({ t: "chr", ch }));
|
|
154
|
+
var func = (name) => ({
|
|
155
|
+
t: "func",
|
|
156
|
+
name: upright(name),
|
|
157
|
+
body: []
|
|
158
|
+
});
|
|
159
|
+
var acc = (chr) => ({ t: "acc", chr, body: [] });
|
|
160
|
+
var mat = (rows, cols) => ({
|
|
161
|
+
t: "mat",
|
|
162
|
+
cols,
|
|
163
|
+
cells: Array.from({ length: rows * cols }, () => [])
|
|
164
|
+
});
|
|
165
|
+
var braced = (l, r, rows, cols) => ({
|
|
166
|
+
t: "fence",
|
|
167
|
+
l,
|
|
168
|
+
r,
|
|
169
|
+
body: [mat(rows, cols)]
|
|
170
|
+
});
|
|
171
|
+
var lim = (name, below = true) => ({
|
|
172
|
+
t: "lim",
|
|
173
|
+
base: upright(name),
|
|
174
|
+
lim: [],
|
|
175
|
+
below
|
|
176
|
+
});
|
|
177
|
+
var big = (op, limits = false) => ({
|
|
178
|
+
t: "big",
|
|
179
|
+
op,
|
|
180
|
+
lo: [],
|
|
181
|
+
hi: [],
|
|
182
|
+
body: [],
|
|
183
|
+
showLo: limits,
|
|
184
|
+
showHi: limits
|
|
185
|
+
});
|
|
186
|
+
var EQ_STRUCTURES = [
|
|
187
|
+
{ group: "Fraction", name: "Stacked", node: frac(), focus: ["num"] },
|
|
188
|
+
{ group: "Script", name: "Superscript", node: scr("sup"), focus: ["sup"] },
|
|
189
|
+
{ group: "Script", name: "Subscript", node: scr("sub"), focus: ["sub"] },
|
|
190
|
+
{ group: "Script", name: "Sub and super", node: scr("both"), focus: ["sub"] },
|
|
191
|
+
{ group: "Radical", name: "Square root", node: rad(false), focus: ["body"] },
|
|
192
|
+
{ group: "Radical", name: "Nth root", node: rad(true), focus: ["deg"] },
|
|
193
|
+
{ group: "Integral", name: "Integral", node: big("\u222B"), focus: ["body"] },
|
|
194
|
+
{ group: "Integral", name: "Definite", node: big("\u222B", true), focus: ["lo"] },
|
|
195
|
+
{ group: "Integral", name: "Double", node: big("\u222C"), focus: ["body"] },
|
|
196
|
+
{ group: "Integral", name: "Contour", node: big("\u222E"), focus: ["body"] },
|
|
197
|
+
{
|
|
198
|
+
group: "Large operator",
|
|
199
|
+
name: "Summation",
|
|
200
|
+
node: big("\u2211"),
|
|
201
|
+
focus: ["body"]
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
group: "Large operator",
|
|
205
|
+
name: "Sum with limits",
|
|
206
|
+
node: big("\u2211", true),
|
|
207
|
+
focus: ["lo"]
|
|
208
|
+
},
|
|
209
|
+
{ group: "Large operator", name: "Product", node: big("\u220F"), focus: ["body"] },
|
|
210
|
+
{
|
|
211
|
+
group: "Large operator",
|
|
212
|
+
name: "Product with limits",
|
|
213
|
+
node: big("\u220F", true),
|
|
214
|
+
focus: ["lo"]
|
|
215
|
+
},
|
|
216
|
+
{ group: "Large operator", name: "Union", node: big("\u22C3"), focus: ["body"] },
|
|
217
|
+
{
|
|
218
|
+
group: "Large operator",
|
|
219
|
+
name: "Intersection",
|
|
220
|
+
node: big("\u22C2"),
|
|
221
|
+
focus: ["body"]
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
group: "Bracket",
|
|
225
|
+
name: "Parentheses",
|
|
226
|
+
node: fence("(", ")"),
|
|
227
|
+
focus: ["body"]
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
group: "Bracket",
|
|
231
|
+
name: "Brackets",
|
|
232
|
+
node: fence("[", "]"),
|
|
233
|
+
focus: ["body"]
|
|
234
|
+
},
|
|
235
|
+
{ group: "Bracket", name: "Braces", node: fence("{", "}"), focus: ["body"] },
|
|
236
|
+
{
|
|
237
|
+
group: "Bracket",
|
|
238
|
+
name: "Absolute value",
|
|
239
|
+
node: fence("|", "|"),
|
|
240
|
+
focus: ["body"]
|
|
241
|
+
},
|
|
242
|
+
{ group: "Bracket", name: "Norm", node: fence("\u2016", "\u2016"), focus: ["body"] },
|
|
243
|
+
{ group: "Bracket", name: "Angle", node: fence("\u27E8", "\u27E9"), focus: ["body"] },
|
|
244
|
+
{ group: "Bracket", name: "Floor", node: fence("\u230A", "\u230B"), focus: ["body"] },
|
|
245
|
+
{ group: "Bracket", name: "Ceiling", node: fence("\u2308", "\u2309"), focus: ["body"] },
|
|
246
|
+
{ group: "Function", name: "sin", node: func("sin"), focus: ["body"] },
|
|
247
|
+
{ group: "Function", name: "cos", node: func("cos"), focus: ["body"] },
|
|
248
|
+
{ group: "Function", name: "tan", node: func("tan"), focus: ["body"] },
|
|
249
|
+
{ group: "Function", name: "cot", node: func("cot"), focus: ["body"] },
|
|
250
|
+
{ group: "Function", name: "ln", node: func("ln"), focus: ["body"] },
|
|
251
|
+
{ group: "Function", name: "log", node: func("log"), focus: ["body"] },
|
|
252
|
+
{ group: "Function", name: "exp", node: func("exp"), focus: ["body"] },
|
|
253
|
+
// The name is empty and editable — for anything the list does not carry.
|
|
254
|
+
{ group: "Function", name: "Custom", node: func(""), focus: ["name"] },
|
|
255
|
+
{ group: "Accent", name: "Bar", node: acc("\u0305"), focus: ["body"] },
|
|
256
|
+
{ group: "Accent", name: "Vector", node: acc("\u20D7"), focus: ["body"] },
|
|
257
|
+
{ group: "Accent", name: "Hat", node: acc("\u0302"), focus: ["body"] },
|
|
258
|
+
{ group: "Accent", name: "Tilde", node: acc("\u0303"), focus: ["body"] },
|
|
259
|
+
{ group: "Accent", name: "Dot", node: acc("\u0307"), focus: ["body"] },
|
|
260
|
+
{ group: "Accent", name: "Double dot", node: acc("\u0308"), focus: ["body"] },
|
|
261
|
+
{ group: "Limit", name: "Limit", node: lim("lim"), focus: ["lim"] },
|
|
262
|
+
{ group: "Limit", name: "Maximum", node: lim("max"), focus: ["lim"] },
|
|
263
|
+
{ group: "Limit", name: "Minimum", node: lim("min"), focus: ["lim"] },
|
|
264
|
+
{ group: "Limit", name: "Over", node: lim("", false), focus: ["base"] },
|
|
265
|
+
{ group: "Matrix", name: "1\xD72", node: mat(1, 2), focus: ["c0"] },
|
|
266
|
+
{ group: "Matrix", name: "2\xD71", node: mat(2, 1), focus: ["c0"] },
|
|
267
|
+
{ group: "Matrix", name: "2\xD72", node: mat(2, 2), focus: ["c0"] },
|
|
268
|
+
{ group: "Matrix", name: "3\xD73", node: mat(3, 3), focus: ["c0"] },
|
|
269
|
+
{
|
|
270
|
+
group: "Matrix",
|
|
271
|
+
name: "Bracketed 2\xD72",
|
|
272
|
+
node: braced("[", "]", 2, 2),
|
|
273
|
+
focus: ["body", 0, "c0"]
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
group: "Matrix",
|
|
277
|
+
name: "Determinant 2\xD72",
|
|
278
|
+
node: braced("|", "|", 2, 2),
|
|
279
|
+
focus: ["body", 0, "c0"]
|
|
280
|
+
},
|
|
281
|
+
// Two and three equations under one brace — how a system is set in
|
|
282
|
+
// Vietnamese exam papers, and awkward to build out of the pieces.
|
|
283
|
+
{
|
|
284
|
+
group: "Matrix",
|
|
285
|
+
name: "System of 2",
|
|
286
|
+
node: braced("{", "", 2, 1),
|
|
287
|
+
focus: ["body", 0, "c0"]
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
group: "Matrix",
|
|
291
|
+
name: "System of 3",
|
|
292
|
+
node: braced("{", "", 3, 1),
|
|
293
|
+
focus: ["body", 0, "c0"]
|
|
294
|
+
}
|
|
295
|
+
];
|
|
107
296
|
|
|
108
297
|
// packages/model/src/lib/model.ts
|
|
109
298
|
function dataJson(el, name) {
|
|
@@ -398,6 +587,11 @@ var schema = new Schema({
|
|
|
398
587
|
// The same equation as an AST (EqNode[]) — what conversion turns
|
|
399
588
|
// into a real 2D equation node. Null when undecodable.
|
|
400
589
|
equationAst: { default: null },
|
|
590
|
+
// `o:OLEObject/@ProgID` when this box is an EMBEDDED OBJECT rather
|
|
591
|
+
// than a picture ("Equation.DSMT4" for MathType). The bitmap is only
|
|
592
|
+
// the object's preview, so the editor offers object tools, not the
|
|
593
|
+
// picture toolkit. Null for real pictures.
|
|
594
|
+
oleProgId: { default: null },
|
|
401
595
|
// w:position on the run holding a legacy object — baseline shift in
|
|
402
596
|
// px, positive UP (same convention as InlineRun.raise). MathType
|
|
403
597
|
// lowers every equation so its baseline meets the text line's.
|
package/dist/lib/model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/lib/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AA2F3C;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,+
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/lib/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AA2F3C;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,+XA2uBjB,CAAC;AAEH,wEAAwE;AACxE,MAAM,MAAM,aAAa,GAAG,OAAO,MAAM,CAAC;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,aAAa,yDA0CxB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC;AAEjD,qDAAqD;AACrD,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;AAE5D;+EAC+E;AAC/E,MAAM,WAAW,MAAM;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,2EAA2E;AAC3E,MAAM,WAAW,OAAO;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IACxC;;;6EAGyE;IACzE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAAC;CACvC;AA0BD;;;4EAG4E;AAC5E,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shadow-garden/bapbong-model",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "bapbong — ProseMirror document model / schema",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -55,6 +55,6 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"prosemirror-model": "^1.25.7",
|
|
58
|
-
"@shadow-garden/bapbong-contracts": "^0.
|
|
58
|
+
"@shadow-garden/bapbong-contracts": "^0.15.0"
|
|
59
59
|
}
|
|
60
60
|
}
|