@formfeed/mcp 0.3.10 → 0.3.11
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/bin/formfeed-mcp.mjs +748 -137
- package/package.json +1 -1
package/bin/formfeed-mcp.mjs
CHANGED
|
@@ -4409,7 +4409,7 @@ var require_browser = __commonJS({
|
|
|
4409
4409
|
var QRCode = require_qrcode();
|
|
4410
4410
|
var CanvasRenderer = require_canvas();
|
|
4411
4411
|
var SvgRenderer = require_svg_tag();
|
|
4412
|
-
function renderCanvas(renderFunc, canvas,
|
|
4412
|
+
function renderCanvas(renderFunc, canvas, text3, opts, cb) {
|
|
4413
4413
|
const args2 = [].slice.call(arguments, 1);
|
|
4414
4414
|
const argsNum = args2.length;
|
|
4415
4415
|
const isLastArgCb = typeof args2[argsNum - 1] === "function";
|
|
@@ -4421,8 +4421,8 @@ var require_browser = __commonJS({
|
|
|
4421
4421
|
throw new Error("Too few arguments provided");
|
|
4422
4422
|
}
|
|
4423
4423
|
if (argsNum === 2) {
|
|
4424
|
-
cb =
|
|
4425
|
-
|
|
4424
|
+
cb = text3;
|
|
4425
|
+
text3 = canvas;
|
|
4426
4426
|
canvas = opts = void 0;
|
|
4427
4427
|
} else if (argsNum === 3) {
|
|
4428
4428
|
if (canvas.getContext && typeof cb === "undefined") {
|
|
@@ -4430,8 +4430,8 @@ var require_browser = __commonJS({
|
|
|
4430
4430
|
opts = void 0;
|
|
4431
4431
|
} else {
|
|
4432
4432
|
cb = opts;
|
|
4433
|
-
opts =
|
|
4434
|
-
|
|
4433
|
+
opts = text3;
|
|
4434
|
+
text3 = canvas;
|
|
4435
4435
|
canvas = void 0;
|
|
4436
4436
|
}
|
|
4437
4437
|
}
|
|
@@ -4440,16 +4440,16 @@ var require_browser = __commonJS({
|
|
|
4440
4440
|
throw new Error("Too few arguments provided");
|
|
4441
4441
|
}
|
|
4442
4442
|
if (argsNum === 1) {
|
|
4443
|
-
|
|
4443
|
+
text3 = canvas;
|
|
4444
4444
|
canvas = opts = void 0;
|
|
4445
4445
|
} else if (argsNum === 2 && !canvas.getContext) {
|
|
4446
|
-
opts =
|
|
4447
|
-
|
|
4446
|
+
opts = text3;
|
|
4447
|
+
text3 = canvas;
|
|
4448
4448
|
canvas = void 0;
|
|
4449
4449
|
}
|
|
4450
4450
|
return new Promise(function(resolve2, reject) {
|
|
4451
4451
|
try {
|
|
4452
|
-
const data = QRCode.create(
|
|
4452
|
+
const data = QRCode.create(text3, opts);
|
|
4453
4453
|
resolve2(renderFunc(data, canvas, opts));
|
|
4454
4454
|
} catch (e) {
|
|
4455
4455
|
reject(e);
|
|
@@ -4457,7 +4457,7 @@ var require_browser = __commonJS({
|
|
|
4457
4457
|
});
|
|
4458
4458
|
}
|
|
4459
4459
|
try {
|
|
4460
|
-
const data = QRCode.create(
|
|
4460
|
+
const data = QRCode.create(text3, opts);
|
|
4461
4461
|
cb(null, renderFunc(data, canvas, opts));
|
|
4462
4462
|
} catch (e) {
|
|
4463
4463
|
cb(e);
|
|
@@ -4482,8 +4482,8 @@ var require_server = __commonJS({
|
|
|
4482
4482
|
var Utf8Renderer = require_utf8();
|
|
4483
4483
|
var TerminalRenderer = require_terminal2();
|
|
4484
4484
|
var SvgRenderer = require_svg();
|
|
4485
|
-
function checkParams(
|
|
4486
|
-
if (typeof
|
|
4485
|
+
function checkParams(text3, opts, cb) {
|
|
4486
|
+
if (typeof text3 === "undefined") {
|
|
4487
4487
|
throw new Error("String required as first argument");
|
|
4488
4488
|
}
|
|
4489
4489
|
if (typeof cb === "undefined") {
|
|
@@ -4530,11 +4530,11 @@ var require_server = __commonJS({
|
|
|
4530
4530
|
return Utf8Renderer;
|
|
4531
4531
|
}
|
|
4532
4532
|
}
|
|
4533
|
-
function render(renderFunc,
|
|
4533
|
+
function render(renderFunc, text3, params) {
|
|
4534
4534
|
if (!params.cb) {
|
|
4535
4535
|
return new Promise(function(resolve2, reject) {
|
|
4536
4536
|
try {
|
|
4537
|
-
const data = QRCode.create(
|
|
4537
|
+
const data = QRCode.create(text3, params.opts);
|
|
4538
4538
|
return renderFunc(data, params.opts, function(err, data2) {
|
|
4539
4539
|
return err ? reject(err) : resolve2(data2);
|
|
4540
4540
|
});
|
|
@@ -4544,7 +4544,7 @@ var require_server = __commonJS({
|
|
|
4544
4544
|
});
|
|
4545
4545
|
}
|
|
4546
4546
|
try {
|
|
4547
|
-
const data = QRCode.create(
|
|
4547
|
+
const data = QRCode.create(text3, params.opts);
|
|
4548
4548
|
return renderFunc(data, params.opts, params.cb);
|
|
4549
4549
|
} catch (e) {
|
|
4550
4550
|
params.cb(e);
|
|
@@ -4552,43 +4552,43 @@ var require_server = __commonJS({
|
|
|
4552
4552
|
}
|
|
4553
4553
|
exports.create = QRCode.create;
|
|
4554
4554
|
exports.toCanvas = require_browser().toCanvas;
|
|
4555
|
-
exports.toString = function toString2(
|
|
4556
|
-
const params = checkParams(
|
|
4555
|
+
exports.toString = function toString2(text3, opts, cb) {
|
|
4556
|
+
const params = checkParams(text3, opts, cb);
|
|
4557
4557
|
const type = params.opts ? params.opts.type : void 0;
|
|
4558
4558
|
const renderer = getStringRendererFromType(type);
|
|
4559
|
-
return render(renderer.render,
|
|
4559
|
+
return render(renderer.render, text3, params);
|
|
4560
4560
|
};
|
|
4561
|
-
exports.toDataURL = function toDataURL(
|
|
4562
|
-
const params = checkParams(
|
|
4561
|
+
exports.toDataURL = function toDataURL(text3, opts, cb) {
|
|
4562
|
+
const params = checkParams(text3, opts, cb);
|
|
4563
4563
|
const renderer = getRendererFromType(params.opts.type);
|
|
4564
|
-
return render(renderer.renderToDataURL,
|
|
4564
|
+
return render(renderer.renderToDataURL, text3, params);
|
|
4565
4565
|
};
|
|
4566
|
-
exports.toBuffer = function toBuffer(
|
|
4567
|
-
const params = checkParams(
|
|
4566
|
+
exports.toBuffer = function toBuffer(text3, opts, cb) {
|
|
4567
|
+
const params = checkParams(text3, opts, cb);
|
|
4568
4568
|
const renderer = getRendererFromType(params.opts.type);
|
|
4569
|
-
return render(renderer.renderToBuffer,
|
|
4569
|
+
return render(renderer.renderToBuffer, text3, params);
|
|
4570
4570
|
};
|
|
4571
|
-
exports.toFile = function toFile(path,
|
|
4572
|
-
if (typeof path !== "string" || !(typeof
|
|
4571
|
+
exports.toFile = function toFile(path, text3, opts, cb) {
|
|
4572
|
+
if (typeof path !== "string" || !(typeof text3 === "string" || typeof text3 === "object")) {
|
|
4573
4573
|
throw new Error("Invalid argument");
|
|
4574
4574
|
}
|
|
4575
4575
|
if (arguments.length < 3 && !canPromise()) {
|
|
4576
4576
|
throw new Error("Too few arguments provided");
|
|
4577
4577
|
}
|
|
4578
|
-
const params = checkParams(
|
|
4578
|
+
const params = checkParams(text3, opts, cb);
|
|
4579
4579
|
const type = params.opts.type || getTypeFromFilename(path);
|
|
4580
4580
|
const renderer = getRendererFromType(type);
|
|
4581
4581
|
const renderToFile = renderer.renderToFile.bind(null, path);
|
|
4582
|
-
return render(renderToFile,
|
|
4582
|
+
return render(renderToFile, text3, params);
|
|
4583
4583
|
};
|
|
4584
|
-
exports.toFileStream = function toFileStream(stream,
|
|
4584
|
+
exports.toFileStream = function toFileStream(stream, text3, opts) {
|
|
4585
4585
|
if (arguments.length < 2) {
|
|
4586
4586
|
throw new Error("Too few arguments provided");
|
|
4587
4587
|
}
|
|
4588
|
-
const params = checkParams(
|
|
4588
|
+
const params = checkParams(text3, opts, stream.emit.bind(stream, "error"));
|
|
4589
4589
|
const renderer = getRendererFromType("png");
|
|
4590
4590
|
const renderToFileStream = renderer.renderToFileStream.bind(null, stream);
|
|
4591
|
-
render(renderToFileStream,
|
|
4591
|
+
render(renderToFileStream, text3, params);
|
|
4592
4592
|
};
|
|
4593
4593
|
}
|
|
4594
4594
|
});
|
|
@@ -9924,11 +9924,11 @@ var require_javascript_compiler = __commonJS({
|
|
|
9924
9924
|
// This operation emits more code than the other options,
|
|
9925
9925
|
// and can be avoided by passing the `knownHelpers` and
|
|
9926
9926
|
// `knownHelpersOnly` flags at compile-time.
|
|
9927
|
-
invokeAmbiguous: function invokeAmbiguous(name,
|
|
9927
|
+
invokeAmbiguous: function invokeAmbiguous(name, helperCall2) {
|
|
9928
9928
|
this.useRegister("helper");
|
|
9929
9929
|
var nonHelper = this.popStack();
|
|
9930
9930
|
this.emptyHash();
|
|
9931
|
-
var helper = this.setupHelper(0, name,
|
|
9931
|
+
var helper = this.setupHelper(0, name, helperCall2);
|
|
9932
9932
|
var helperName = this.lastHelper = this.nameLookup("helpers", name, "helper");
|
|
9933
9933
|
var lookup = ["(", "(helper = ", helperName, " || ", nonHelper, ")"];
|
|
9934
9934
|
if (!this.options.strict) {
|
|
@@ -13476,10 +13476,10 @@ var require_nunjucks = __commonJS({
|
|
|
13476
13476
|
return node;
|
|
13477
13477
|
};
|
|
13478
13478
|
_proto.parseExtends = function parseExtends() {
|
|
13479
|
-
var
|
|
13479
|
+
var tagName2 = "extends";
|
|
13480
13480
|
var tag = this.peekToken();
|
|
13481
|
-
if (!this.skipSymbol(
|
|
13482
|
-
this.fail("parseTemplateRef: expected " +
|
|
13481
|
+
if (!this.skipSymbol(tagName2)) {
|
|
13482
|
+
this.fail("parseTemplateRef: expected " + tagName2);
|
|
13483
13483
|
}
|
|
13484
13484
|
var node = new nodes.Extends(tag.lineno, tag.colno);
|
|
13485
13485
|
node.template = this.parseExpression();
|
|
@@ -13487,10 +13487,10 @@ var require_nunjucks = __commonJS({
|
|
|
13487
13487
|
return node;
|
|
13488
13488
|
};
|
|
13489
13489
|
_proto.parseInclude = function parseInclude() {
|
|
13490
|
-
var
|
|
13490
|
+
var tagName2 = "include";
|
|
13491
13491
|
var tag = this.peekToken();
|
|
13492
|
-
if (!this.skipSymbol(
|
|
13493
|
-
this.fail("parseInclude: expected " +
|
|
13492
|
+
if (!this.skipSymbol(tagName2)) {
|
|
13493
|
+
this.fail("parseInclude: expected " + tagName2);
|
|
13494
13494
|
}
|
|
13495
13495
|
var node = new nodes.Include(tag.lineno, tag.colno);
|
|
13496
13496
|
node.template = this.parseExpression();
|
|
@@ -13651,10 +13651,10 @@ var require_nunjucks = __commonJS({
|
|
|
13651
13651
|
}
|
|
13652
13652
|
return node;
|
|
13653
13653
|
};
|
|
13654
|
-
_proto.parseRaw = function parseRaw(
|
|
13655
|
-
|
|
13656
|
-
var endTagName = "end" +
|
|
13657
|
-
var rawBlockRegex = new RegExp("([\\s\\S]*?){%\\s*(" +
|
|
13654
|
+
_proto.parseRaw = function parseRaw(tagName2) {
|
|
13655
|
+
tagName2 = tagName2 || "raw";
|
|
13656
|
+
var endTagName = "end" + tagName2;
|
|
13657
|
+
var rawBlockRegex = new RegExp("([\\s\\S]*?){%\\s*(" + tagName2 + "|" + endTagName + ")\\s*(?=%})%}");
|
|
13658
13658
|
var rawLevel = 1;
|
|
13659
13659
|
var str2 = "";
|
|
13660
13660
|
var matches = null;
|
|
@@ -13663,7 +13663,7 @@ var require_nunjucks = __commonJS({
|
|
|
13663
13663
|
var all = matches[0];
|
|
13664
13664
|
var pre = matches[1];
|
|
13665
13665
|
var blockName = matches[2];
|
|
13666
|
-
if (blockName ===
|
|
13666
|
+
if (blockName === tagName2) {
|
|
13667
13667
|
rawLevel += 1;
|
|
13668
13668
|
} else if (blockName === endTagName) {
|
|
13669
13669
|
rawLevel -= 1;
|
|
@@ -16092,7 +16092,7 @@ var require_nunjucks = __commonJS({
|
|
|
16092
16092
|
}
|
|
16093
16093
|
function globals() {
|
|
16094
16094
|
return {
|
|
16095
|
-
range: function
|
|
16095
|
+
range: function range2(start, stop, step) {
|
|
16096
16096
|
if (typeof stop === "undefined") {
|
|
16097
16097
|
stop = start;
|
|
16098
16098
|
start = 0;
|
|
@@ -16689,7 +16689,7 @@ var require_liquid_node = __commonJS({
|
|
|
16689
16689
|
const type = typeof value;
|
|
16690
16690
|
return value !== null && (type === "object" || type === "function");
|
|
16691
16691
|
}
|
|
16692
|
-
function
|
|
16692
|
+
function range2(start, stop, step = 1) {
|
|
16693
16693
|
const arr = [];
|
|
16694
16694
|
for (let i = start; i < stop; i += step) {
|
|
16695
16695
|
arr.push(i);
|
|
@@ -16854,14 +16854,14 @@ var require_liquid_node = __commonJS({
|
|
|
16854
16854
|
const lines = token.input.split("\n");
|
|
16855
16855
|
const begin = Math.max(line - 2, 1);
|
|
16856
16856
|
const end = Math.min(line + 3, lines.length);
|
|
16857
|
-
const context =
|
|
16857
|
+
const context = range2(begin, end + 1).map((lineNumber) => {
|
|
16858
16858
|
const rowIndicator = lineNumber === line ? ">> " : " ";
|
|
16859
16859
|
const num = padStart(String(lineNumber), String(end).length);
|
|
16860
|
-
let
|
|
16861
|
-
const colIndicator = lineNumber === line ? "\n" + padStart("^", col +
|
|
16862
|
-
|
|
16863
|
-
|
|
16864
|
-
return
|
|
16860
|
+
let text3 = `${rowIndicator}${num}| `;
|
|
16861
|
+
const colIndicator = lineNumber === line ? "\n" + padStart("^", col + text3.length) : "";
|
|
16862
|
+
text3 += lines[lineNumber - 1];
|
|
16863
|
+
text3 += colIndicator;
|
|
16864
|
+
return text3;
|
|
16865
16865
|
}).join("\n");
|
|
16866
16866
|
return context;
|
|
16867
16867
|
}
|
|
@@ -17819,7 +17819,7 @@ var require_liquid_node = __commonJS({
|
|
|
17819
17819
|
const low = yield evalToken(token.lhs, ctx);
|
|
17820
17820
|
const high = yield evalToken(token.rhs, ctx);
|
|
17821
17821
|
ctx.memoryLimit.use(high - low + 1);
|
|
17822
|
-
return
|
|
17822
|
+
return range2(+low, +high + 1);
|
|
17823
17823
|
}
|
|
17824
17824
|
function* toPostfix(tokens) {
|
|
17825
17825
|
const ops = [];
|
|
@@ -18335,12 +18335,12 @@ var require_liquid_node = __commonJS({
|
|
|
18335
18335
|
token.trimLeft++;
|
|
18336
18336
|
}
|
|
18337
18337
|
var Tokenizer = class {
|
|
18338
|
-
constructor(input, operators = defaultOptions2.operators, file,
|
|
18338
|
+
constructor(input, operators = defaultOptions2.operators, file, range3, groupedExpressions = false) {
|
|
18339
18339
|
this.input = input;
|
|
18340
18340
|
this.file = file;
|
|
18341
18341
|
this.rawBeginAt = -1;
|
|
18342
|
-
this.p =
|
|
18343
|
-
this.N =
|
|
18342
|
+
this.p = range3 ? range3[0] : 0;
|
|
18343
|
+
this.N = range3 ? range3[1] : input.length;
|
|
18344
18344
|
this.opTrie = createTrie(operators);
|
|
18345
18345
|
this.literalTrie = createTrie(literalValues);
|
|
18346
18346
|
this.groupedExpressions = groupedExpressions;
|
|
@@ -19952,20 +19952,20 @@ var require_liquid_node = __commonJS({
|
|
|
19952
19952
|
function date_to_rfc822(v2) {
|
|
19953
19953
|
return date.call(this, v2, "%a, %d %b %Y %H:%M:%S %z");
|
|
19954
19954
|
}
|
|
19955
|
-
function date_to_string(v2, type,
|
|
19956
|
-
return stringify_date.call(this, v2, "%b", type,
|
|
19955
|
+
function date_to_string(v2, type, style2) {
|
|
19956
|
+
return stringify_date.call(this, v2, "%b", type, style2);
|
|
19957
19957
|
}
|
|
19958
|
-
function date_to_long_string(v2, type,
|
|
19959
|
-
return stringify_date.call(this, v2, "%B", type,
|
|
19958
|
+
function date_to_long_string(v2, type, style2) {
|
|
19959
|
+
return stringify_date.call(this, v2, "%B", type, style2);
|
|
19960
19960
|
}
|
|
19961
|
-
function stringify_date(v2, month_type, type,
|
|
19961
|
+
function stringify_date(v2, month_type, type, style2) {
|
|
19962
19962
|
const date2 = parseDate2(v2, this.context.opts);
|
|
19963
19963
|
if (!date2)
|
|
19964
19964
|
return v2;
|
|
19965
19965
|
const ml = this.context.memoryLimit;
|
|
19966
19966
|
if (type === "ordinal") {
|
|
19967
19967
|
const d = date2.getDate();
|
|
19968
|
-
return
|
|
19968
|
+
return style2 === "US" ? strftime(date2, `${month_type} ${d}%q, %Y`, ml) : strftime(date2, `${d}%q ${month_type} %Y`, ml);
|
|
19969
19969
|
}
|
|
19970
19970
|
return strftime(date2, `%d ${month_type} %Y`, ml);
|
|
19971
19971
|
}
|
|
@@ -67329,9 +67329,9 @@ function bwipp_validatetext() {
|
|
|
67329
67329
|
}
|
|
67330
67330
|
$_ = $__;
|
|
67331
67331
|
}
|
|
67332
|
-
function bwipp_encode(bwipjs, encoder3,
|
|
67333
|
-
if (typeof
|
|
67334
|
-
throw new Error("bwipp.typeError: barcode text not a string (" +
|
|
67332
|
+
function bwipp_encode(bwipjs, encoder3, text3, opts, dontdraw) {
|
|
67333
|
+
if (typeof text3 !== "string") {
|
|
67334
|
+
throw new Error("bwipp.typeError: barcode text not a string (" + text3 + ")");
|
|
67335
67335
|
}
|
|
67336
67336
|
opts = opts || {};
|
|
67337
67337
|
if (typeof opts === "string") {
|
|
@@ -67356,11 +67356,11 @@ function bwipp_encode(bwipjs, encoder3, text2, opts, dontdraw) {
|
|
|
67356
67356
|
throw new Error("bwipp.typeError: options not an object");
|
|
67357
67357
|
}
|
|
67358
67358
|
if (opts.binarytext) {
|
|
67359
|
-
if (/[\u0100-\uffff]/.test(
|
|
67359
|
+
if (/[\u0100-\uffff]/.test(text3)) {
|
|
67360
67360
|
throw new Error("bwip-js: 16-bit chars not allowed with binarytext");
|
|
67361
67361
|
}
|
|
67362
|
-
} else if (/[\u0080-\uffff]/.test(
|
|
67363
|
-
|
|
67362
|
+
} else if (/[\u0080-\uffff]/.test(text3)) {
|
|
67363
|
+
text3 = unescape(encodeURIComponent(text3));
|
|
67364
67364
|
}
|
|
67365
67365
|
if (opts.dontdraw) {
|
|
67366
67366
|
dontdraw = true;
|
|
@@ -67372,7 +67372,7 @@ function bwipp_encode(bwipjs, encoder3, text2, opts, dontdraw) {
|
|
|
67372
67372
|
}
|
|
67373
67373
|
}
|
|
67374
67374
|
$$ = bwipjs;
|
|
67375
|
-
$k = [
|
|
67375
|
+
$k = [text3, map];
|
|
67376
67376
|
$j = 2;
|
|
67377
67377
|
$_ = {
|
|
67378
67378
|
bwipjs_rawstack: dontdraw ? [] : false
|
|
@@ -67683,8 +67683,8 @@ var BWIPJS_OPTIONS = {
|
|
|
67683
67683
|
backgroundcolor: 1
|
|
67684
67684
|
};
|
|
67685
67685
|
function _Render(encoder3, options, drawing) {
|
|
67686
|
-
var
|
|
67687
|
-
if (!
|
|
67686
|
+
var text3 = options.text;
|
|
67687
|
+
if (!text3) {
|
|
67688
67688
|
throw new ReferenceError("bwip-js: bar code text not specified.");
|
|
67689
67689
|
}
|
|
67690
67690
|
FixupOptions(options);
|
|
@@ -67709,7 +67709,7 @@ function _Render(encoder3, options, drawing) {
|
|
|
67709
67709
|
bwippopts.width = bwippopts.width / 25.4 || 0;
|
|
67710
67710
|
}
|
|
67711
67711
|
bw.scale(scaleX, scaleY);
|
|
67712
|
-
bwipp_encode(bw, encoder3,
|
|
67712
|
+
bwipp_encode(bw, encoder3, text3, bwippopts);
|
|
67713
67713
|
return bw.render();
|
|
67714
67714
|
}
|
|
67715
67715
|
var BWIPJS = (function() {
|
|
@@ -70686,6 +70686,12 @@ var barcodeTypes = {
|
|
|
70686
70686
|
datamatrix: "datamatrix",
|
|
70687
70687
|
pdf417: "pdf417"
|
|
70688
70688
|
};
|
|
70689
|
+
var ownTextLayout = /* @__PURE__ */ new Set(["ean13", "ean8", "upca"]);
|
|
70690
|
+
function codeText(helper, value) {
|
|
70691
|
+
const text3 = value === void 0 || value === null ? "" : String(value);
|
|
70692
|
+
if (text3 === "") throw new Error(`${helper}: nothing to encode, the value is empty or missing from the data`);
|
|
70693
|
+
return text3;
|
|
70694
|
+
}
|
|
70689
70695
|
var codeHelpers = [
|
|
70690
70696
|
{
|
|
70691
70697
|
name: "qrcode",
|
|
@@ -70702,7 +70708,7 @@ var codeHelpers = [
|
|
|
70702
70708
|
},
|
|
70703
70709
|
fn: (ctx, value, options) => {
|
|
70704
70710
|
const o = options ?? {};
|
|
70705
|
-
const svg = qrSvg(
|
|
70711
|
+
const svg = qrSvg(codeText("qrcode", value), o);
|
|
70706
70712
|
if (ctx.drawing) return ctx.drawing({ kind: "svg", svg, width: o.size, height: o.size, alt: "QR code" });
|
|
70707
70713
|
return svgDataUri(svg);
|
|
70708
70714
|
}
|
|
@@ -70722,16 +70728,17 @@ var codeHelpers = [
|
|
|
70722
70728
|
fn: (ctx, value, options) => {
|
|
70723
70729
|
const o = options ?? {};
|
|
70724
70730
|
const bcid = barcodeTypes[String(o.type ?? "code128").toLowerCase()] ?? "code128";
|
|
70731
|
+
const text3 = codeText("barcode", value);
|
|
70725
70732
|
const svg = ToSVG({
|
|
70726
70733
|
bcid,
|
|
70727
|
-
text:
|
|
70734
|
+
text: text3,
|
|
70728
70735
|
height: o.height ?? 12,
|
|
70729
70736
|
...o.width === void 0 ? {} : { width: o.width },
|
|
70730
70737
|
scale: o.scale ?? 2,
|
|
70731
70738
|
includetext: o.text !== false,
|
|
70732
|
-
textxalign: "center"
|
|
70739
|
+
...ownTextLayout.has(bcid) ? {} : { textxalign: "center" }
|
|
70733
70740
|
});
|
|
70734
|
-
if (ctx.drawing) return ctx.drawing({ kind: "svg", svg, alt: `Barcode ${
|
|
70741
|
+
if (ctx.drawing) return ctx.drawing({ kind: "svg", svg, alt: `Barcode ${text3}` });
|
|
70735
70742
|
return svgDataUri(svg);
|
|
70736
70743
|
}
|
|
70737
70744
|
},
|
|
@@ -77594,6 +77601,16 @@ var currencyValues6 = { currency: (
|
|
|
77594
77601
|
Object.keys(nl2)
|
|
77595
77602
|
) };
|
|
77596
77603
|
|
|
77604
|
+
// packages/engine/src/lib/translation.ts
|
|
77605
|
+
function resolveTranslation(dictionaries, locale, key) {
|
|
77606
|
+
const lang = locale.split("-")[0] ?? locale;
|
|
77607
|
+
for (const candidate of [locale, lang, "en"]) {
|
|
77608
|
+
const text3 = dictionaries?.[candidate]?.[key];
|
|
77609
|
+
if (typeof text3 === "string") return { text: text3, from: candidate };
|
|
77610
|
+
}
|
|
77611
|
+
return { text: key, from: null };
|
|
77612
|
+
}
|
|
77613
|
+
|
|
77597
77614
|
// packages/engine/src/lib/helpers/office.ts
|
|
77598
77615
|
function officeUnsupported(name) {
|
|
77599
77616
|
return `${name}() is not supported in office templates`;
|
|
@@ -77637,7 +77654,9 @@ var str = (v2) => v2 === void 0 || v2 === null ? "" : String(v2);
|
|
|
77637
77654
|
var opt = (v2, fallback) => v2 === void 0 || v2 === null || v2 === "" ? fallback : v2;
|
|
77638
77655
|
function requireFinite(helper, value) {
|
|
77639
77656
|
if (typeof value === "number" && !Number.isFinite(value))
|
|
77640
|
-
throw new Error(
|
|
77657
|
+
throw new Error(
|
|
77658
|
+
`${helper}: got ${value}, the result of a calculation with a value that is missing or not a number`
|
|
77659
|
+
);
|
|
77641
77660
|
}
|
|
77642
77661
|
var wordsByLang = {
|
|
77643
77662
|
de: toCardinal,
|
|
@@ -77815,13 +77834,20 @@ var formatHelpers = [
|
|
|
77815
77834
|
if (Number.isNaN(n)) return "";
|
|
77816
77835
|
const named = args2.find(isNamedArgs) ?? {};
|
|
77817
77836
|
const [decimals, method] = args2.filter((a) => !isNamedArgs(a));
|
|
77818
|
-
const places = Number(
|
|
77837
|
+
const places = Number(
|
|
77838
|
+
opt(decimals, opt(named["precision"], opt(named["decimals"], 0)))
|
|
77839
|
+
);
|
|
77819
77840
|
const how = String(opt(method, opt(named["method"], "common")));
|
|
77820
77841
|
const f2 = 10 ** places;
|
|
77821
77842
|
const scaled = Number((Math.abs(n) * f2).toPrecision(15));
|
|
77822
|
-
if (how === "floor")
|
|
77823
|
-
|
|
77824
|
-
if (how
|
|
77843
|
+
if (how === "floor")
|
|
77844
|
+
return (n < 0 ? -Math.ceil(scaled) : Math.floor(scaled)) / f2;
|
|
77845
|
+
if (how === "ceil")
|
|
77846
|
+
return (n < 0 ? -Math.floor(scaled) : Math.ceil(scaled)) / f2;
|
|
77847
|
+
if (how !== "common")
|
|
77848
|
+
throw new Error(
|
|
77849
|
+
`round: method must be 'common', 'floor' or 'ceil', not '${how}'`
|
|
77850
|
+
);
|
|
77825
77851
|
return Math.round(scaled + Number.EPSILON) / f2 * Math.sign(n);
|
|
77826
77852
|
}
|
|
77827
77853
|
},
|
|
@@ -78053,11 +78079,9 @@ var formatHelpers = [
|
|
|
78053
78079
|
category: "text"
|
|
78054
78080
|
},
|
|
78055
78081
|
fn: (ctx, key, params) => {
|
|
78056
|
-
const
|
|
78057
|
-
const lang = ctx.locale.split("-")[0] ?? ctx.locale;
|
|
78058
|
-
const text2 = dictionaries[ctx.locale]?.[str(key)] ?? dictionaries[lang]?.[str(key)] ?? dictionaries["en"]?.[str(key)] ?? str(key);
|
|
78082
|
+
const { text: text3 } = resolveTranslation(ctx.i18n, ctx.locale, str(key));
|
|
78059
78083
|
const p = params ?? {};
|
|
78060
|
-
return
|
|
78084
|
+
return text3.replace(/\{(\w+)\}/g, (_2, name) => str(p[name]));
|
|
78061
78085
|
}
|
|
78062
78086
|
},
|
|
78063
78087
|
{
|
|
@@ -78382,8 +78406,8 @@ function imageMarkup(url, options = {}) {
|
|
|
78382
78406
|
options.fit ? `object-fit:${options.fit}` : ""
|
|
78383
78407
|
].filter(Boolean).join(";");
|
|
78384
78408
|
const cls = options.class ? ` class="${escapeHtml(options.class)}"` : "";
|
|
78385
|
-
const
|
|
78386
|
-
return `<img src="${escapeHtml(url)}" alt="${escapeHtml(options.alt ?? "")}"${cls}${
|
|
78409
|
+
const style2 = styles ? ` style="${styles}"` : "";
|
|
78410
|
+
return `<img src="${escapeHtml(url)}" alt="${escapeHtml(options.alt ?? "")}"${cls}${style2}>`;
|
|
78387
78411
|
}
|
|
78388
78412
|
function resolveAsset(base, url) {
|
|
78389
78413
|
if (!base || /^[a-z][a-z0-9+.-]*:/i.test(url)) return url;
|
|
@@ -78662,11 +78686,11 @@ function scanBlocks(source, spec) {
|
|
|
78662
78686
|
while (m2 = pattern.exec(source)) {
|
|
78663
78687
|
const keyword = m2[1] ?? "";
|
|
78664
78688
|
const rest = m2[2] ?? "";
|
|
78665
|
-
const
|
|
78689
|
+
const range2 = rangeOf(source, m2.index, m2.index + m2[0].length);
|
|
78666
78690
|
if (inRaw) {
|
|
78667
78691
|
if (spec.closers[keyword] === inRaw) {
|
|
78668
78692
|
const open = stack.pop();
|
|
78669
|
-
if (open) open.block.close =
|
|
78693
|
+
if (open) open.block.close = range2;
|
|
78670
78694
|
inRaw = null;
|
|
78671
78695
|
}
|
|
78672
78696
|
continue;
|
|
@@ -78674,7 +78698,7 @@ function scanBlocks(source, spec) {
|
|
|
78674
78698
|
if (isBlockOpener(keyword, rest)) {
|
|
78675
78699
|
const block = {
|
|
78676
78700
|
type: spec.openers[keyword] ?? "other",
|
|
78677
|
-
open:
|
|
78701
|
+
open: range2
|
|
78678
78702
|
};
|
|
78679
78703
|
blocks.push(block);
|
|
78680
78704
|
stack.push({ keyword, block });
|
|
@@ -78688,7 +78712,7 @@ function scanBlocks(source, spec) {
|
|
|
78688
78712
|
code: "unexpected-end-tag",
|
|
78689
78713
|
message: `Unexpected {% ${keyword} %} without an open block`,
|
|
78690
78714
|
args: { keyword },
|
|
78691
|
-
range
|
|
78715
|
+
range: range2
|
|
78692
78716
|
});
|
|
78693
78717
|
} else if (top.keyword !== expected) {
|
|
78694
78718
|
diagnostics.push({
|
|
@@ -78696,16 +78720,16 @@ function scanBlocks(source, spec) {
|
|
|
78696
78720
|
code: "mismatched-end-tag",
|
|
78697
78721
|
message: `Expected {% end${top.keyword} %} to close the {% ${top.keyword} %} at line ${top.block.open.start.line}, found {% ${keyword} %}`,
|
|
78698
78722
|
args: { open: top.keyword, line: top.block.open.start.line, found: keyword },
|
|
78699
|
-
range
|
|
78723
|
+
range: range2
|
|
78700
78724
|
});
|
|
78701
78725
|
const idx = stack.map((s) => s.keyword).lastIndexOf(expected);
|
|
78702
78726
|
if (idx >= 0) {
|
|
78703
78727
|
const closed = stack.splice(idx, 1)[0];
|
|
78704
|
-
if (closed) closed.block.close =
|
|
78728
|
+
if (closed) closed.block.close = range2;
|
|
78705
78729
|
}
|
|
78706
78730
|
} else {
|
|
78707
78731
|
stack.pop();
|
|
78708
|
-
top.block.close =
|
|
78732
|
+
top.block.close = range2;
|
|
78709
78733
|
}
|
|
78710
78734
|
} else if (spec.continuations.includes(keyword) && !stack.length) {
|
|
78711
78735
|
diagnostics.push({
|
|
@@ -78713,7 +78737,7 @@ function scanBlocks(source, spec) {
|
|
|
78713
78737
|
code: "unexpected-tag",
|
|
78714
78738
|
message: `{% ${keyword} %} outside of a block`,
|
|
78715
78739
|
args: { keyword },
|
|
78716
|
-
range
|
|
78740
|
+
range: range2
|
|
78717
78741
|
});
|
|
78718
78742
|
}
|
|
78719
78743
|
}
|
|
@@ -79155,8 +79179,8 @@ var SPEC = /^(?:([\s\S])?([<>=^]))?([+\- ])?(#)?(0)?(\d+)?([,_])?(?:\.(\d+))?([b
|
|
|
79155
79179
|
function group(digits, separator) {
|
|
79156
79180
|
return digits.replace(/\B(?=(\d{3})+(?!\d))/g, separator);
|
|
79157
79181
|
}
|
|
79158
|
-
function pythonExponent(
|
|
79159
|
-
return
|
|
79182
|
+
function pythonExponent(text3) {
|
|
79183
|
+
return text3.replace(/e([+-])(\d)$/i, (m2, sign, digit) => `${m2[0]}${sign}0${digit}`);
|
|
79160
79184
|
}
|
|
79161
79185
|
function formatNumber(value, type, precision, alternate) {
|
|
79162
79186
|
if (!Number.isFinite(value)) return Number.isNaN(value) ? "nan" : "inf";
|
|
@@ -79169,20 +79193,20 @@ function formatNumber(value, type, precision, alternate) {
|
|
|
79169
79193
|
return `${(abs * 100).toFixed(precision ?? 6)}%`;
|
|
79170
79194
|
case "e":
|
|
79171
79195
|
case "E": {
|
|
79172
|
-
const
|
|
79173
|
-
return type === "E" ?
|
|
79196
|
+
const text3 = pythonExponent(abs.toExponential(precision ?? 6));
|
|
79197
|
+
return type === "E" ? text3.toUpperCase() : text3;
|
|
79174
79198
|
}
|
|
79175
79199
|
case "g":
|
|
79176
79200
|
case "G": {
|
|
79177
79201
|
const p = precision === 0 ? 1 : precision ?? 6;
|
|
79178
79202
|
const exp = abs === 0 ? 0 : Math.floor(Math.log10(abs));
|
|
79179
|
-
let
|
|
79203
|
+
let text3 = exp < -4 || exp >= p ? pythonExponent(abs.toExponential(p - 1)) : abs.toFixed(Math.max(0, p - 1 - exp));
|
|
79180
79204
|
if (!alternate) {
|
|
79181
|
-
const [mantissa = "", exponent] =
|
|
79205
|
+
const [mantissa = "", exponent] = text3.split("e");
|
|
79182
79206
|
const trimmed = mantissa.includes(".") ? mantissa.replace(/0+$/, "").replace(/\.$/, "") : mantissa;
|
|
79183
|
-
|
|
79207
|
+
text3 = exponent === void 0 ? trimmed : `${trimmed}e${exponent}`;
|
|
79184
79208
|
}
|
|
79185
|
-
return type === "G" ?
|
|
79209
|
+
return type === "G" ? text3.toUpperCase() : text3;
|
|
79186
79210
|
}
|
|
79187
79211
|
case "d":
|
|
79188
79212
|
case "n":
|
|
@@ -79251,35 +79275,35 @@ function lookupField(name, positional, named, next) {
|
|
|
79251
79275
|
function pythonFormat(template, positional, named = {}) {
|
|
79252
79276
|
let auto = 0;
|
|
79253
79277
|
const next = () => auto++;
|
|
79254
|
-
const render = (
|
|
79278
|
+
const render = (text3) => {
|
|
79255
79279
|
let out = "";
|
|
79256
|
-
for (let i = 0; i <
|
|
79257
|
-
const ch =
|
|
79280
|
+
for (let i = 0; i < text3.length; i++) {
|
|
79281
|
+
const ch = text3[i];
|
|
79258
79282
|
if (ch === "}") {
|
|
79259
79283
|
out += "}";
|
|
79260
|
-
if (
|
|
79284
|
+
if (text3[i + 1] === "}") i++;
|
|
79261
79285
|
continue;
|
|
79262
79286
|
}
|
|
79263
79287
|
if (ch !== "{") {
|
|
79264
79288
|
out += ch;
|
|
79265
79289
|
continue;
|
|
79266
79290
|
}
|
|
79267
|
-
if (
|
|
79291
|
+
if (text3[i + 1] === "{") {
|
|
79268
79292
|
out += "{";
|
|
79269
79293
|
i++;
|
|
79270
79294
|
continue;
|
|
79271
79295
|
}
|
|
79272
79296
|
let depth = 1;
|
|
79273
79297
|
let j2 = i + 1;
|
|
79274
|
-
for (; j2 <
|
|
79275
|
-
if (
|
|
79276
|
-
else if (
|
|
79298
|
+
for (; j2 < text3.length && depth > 0; j2++) {
|
|
79299
|
+
if (text3[j2] === "{") depth++;
|
|
79300
|
+
else if (text3[j2] === "}") depth--;
|
|
79277
79301
|
}
|
|
79278
79302
|
if (depth > 0) {
|
|
79279
|
-
out +=
|
|
79303
|
+
out += text3.slice(i);
|
|
79280
79304
|
break;
|
|
79281
79305
|
}
|
|
79282
|
-
const field =
|
|
79306
|
+
const field = text3.slice(i + 1, j2 - 1);
|
|
79283
79307
|
const colon = field.indexOf(":");
|
|
79284
79308
|
const head = colon < 0 ? field : field.slice(0, colon);
|
|
79285
79309
|
const name = head.replace(/![rsa]$/, "");
|
|
@@ -80476,7 +80500,7 @@ function inferSchema(sample) {
|
|
|
80476
80500
|
// packages/engine/src/lib/output.ts
|
|
80477
80501
|
var outputFormats = ["pdf", "png", "jpg", "webp", "docx", "pptx"];
|
|
80478
80502
|
|
|
80479
|
-
// packages/engine/src/lib/
|
|
80503
|
+
// packages/engine/src/lib/dialect.ts
|
|
80480
80504
|
var loop = (engine, item, list2, body) => engine === "handlebars" ? `{{#each ${list2}}}
|
|
80481
80505
|
${body.replace(new RegExp(`(?<![\\w.])${item}\\.`, "g"), "")}
|
|
80482
80506
|
{{/each}}` : `{% for ${item} in ${list2} %}
|
|
@@ -80497,6 +80521,8 @@ var tr = (engine, key, params = {}) => {
|
|
|
80497
80521
|
return `{{ '${key}' | t${entries.length ? ": " + entries.map(([k2, v2]) => `${k2}: ${v2}`).join(", ") : ""} }}`;
|
|
80498
80522
|
return `{{ t('${key}'${entries.length ? `, { ${entries.map(([k2, v2]) => `${k2}: ${v2}`).join(", ")} }` : ""}) }}`;
|
|
80499
80523
|
};
|
|
80524
|
+
|
|
80525
|
+
// packages/engine/src/lib/snippets.ts
|
|
80500
80526
|
function forAll(build) {
|
|
80501
80527
|
return {
|
|
80502
80528
|
jinja2: build("jinja2"),
|
|
@@ -80537,8 +80563,18 @@ var snippets = [
|
|
|
80537
80563
|
</div>$0`
|
|
80538
80564
|
),
|
|
80539
80565
|
sampleData: {
|
|
80540
|
-
company: {
|
|
80541
|
-
|
|
80566
|
+
company: {
|
|
80567
|
+
name: "Fennlor Studio GmbH",
|
|
80568
|
+
street: "Musterstra\xDFe 1",
|
|
80569
|
+
zip: "12345",
|
|
80570
|
+
city: "Musterstadt"
|
|
80571
|
+
},
|
|
80572
|
+
customer: {
|
|
80573
|
+
name: "Olvarest GmbH",
|
|
80574
|
+
street: "Beispielweg 2",
|
|
80575
|
+
zip: "54321",
|
|
80576
|
+
city: "Beispielstadt"
|
|
80577
|
+
}
|
|
80542
80578
|
},
|
|
80543
80579
|
// Form B puts the field 45 mm below the top edge and 20 mm from the left; the page margins decide where it lands
|
|
80544
80580
|
css: `.ff-window { width: 85mm; height: 45mm; box-sizing: border-box; padding: 0 5mm; overflow: hidden; }
|
|
@@ -80565,8 +80601,16 @@ var snippets = [
|
|
|
80565
80601
|
.ff-reference th { text-align: left; font-weight: normal; color: #555; padding: 1px 12px 1px 0; }
|
|
80566
80602
|
.ff-reference td { text-align: right; padding: 1px 0; }`,
|
|
80567
80603
|
i18n: {
|
|
80568
|
-
en: {
|
|
80569
|
-
|
|
80604
|
+
en: {
|
|
80605
|
+
"reference.customer": "Customer no.",
|
|
80606
|
+
"reference.invoice": "Invoice no.",
|
|
80607
|
+
"reference.date": "Date"
|
|
80608
|
+
},
|
|
80609
|
+
de: {
|
|
80610
|
+
"reference.customer": "Kundennummer",
|
|
80611
|
+
"reference.invoice": "Rechnungsnummer",
|
|
80612
|
+
"reference.date": "Datum"
|
|
80613
|
+
}
|
|
80570
80614
|
}
|
|
80571
80615
|
},
|
|
80572
80616
|
{
|
|
@@ -80581,14 +80625,24 @@ var snippets = [
|
|
|
80581
80625
|
</div>$0`
|
|
80582
80626
|
),
|
|
80583
80627
|
sampleData: {
|
|
80584
|
-
invoice: {
|
|
80628
|
+
invoice: {
|
|
80629
|
+
number: "2026-0042",
|
|
80630
|
+
period_start: "2026-09-01",
|
|
80631
|
+
period_end: "2026-09-30"
|
|
80632
|
+
}
|
|
80585
80633
|
},
|
|
80586
80634
|
css: `.ff-heading { margin: 24px 0 16px; }
|
|
80587
80635
|
.ff-heading h1 { font-family: var(--brand-font-heading, inherit); font-size: 18pt; color: var(--brand-color-primary, inherit); margin: 0 0 4px; }
|
|
80588
80636
|
.ff-heading p { margin: 0; color: #555; }`,
|
|
80589
80637
|
i18n: {
|
|
80590
|
-
en: {
|
|
80591
|
-
|
|
80638
|
+
en: {
|
|
80639
|
+
"heading.title": "Invoice {number}",
|
|
80640
|
+
"heading.period": "Service period:"
|
|
80641
|
+
},
|
|
80642
|
+
de: {
|
|
80643
|
+
"heading.title": "Rechnung {number}",
|
|
80644
|
+
"heading.period": "Leistungszeitraum:"
|
|
80645
|
+
}
|
|
80592
80646
|
}
|
|
80593
80647
|
},
|
|
80594
80648
|
{
|
|
@@ -80715,11 +80769,17 @@ ${loop(e, "line", "invoice.lines", ` <tr><td>${val(e, "line.description")}</t
|
|
|
80715
80769
|
group: "invoice",
|
|
80716
80770
|
title: "Small business VAT note",
|
|
80717
80771
|
description: "States that no VAT is charged under \xA7 19 UStG (Kleinunternehmerregelung).",
|
|
80718
|
-
source: forAll(
|
|
80772
|
+
source: forAll(
|
|
80773
|
+
(e) => `<p class="ff-note">${tr(e, "vat.small_business")}</p>$0`
|
|
80774
|
+
),
|
|
80719
80775
|
css: `.ff-note { margin-top: 12px; font-size: 9pt; color: #444; }`,
|
|
80720
80776
|
i18n: {
|
|
80721
|
-
en: {
|
|
80722
|
-
|
|
80777
|
+
en: {
|
|
80778
|
+
"vat.small_business": "No VAT is charged under the small business scheme of \xA7 19 UStG."
|
|
80779
|
+
},
|
|
80780
|
+
de: {
|
|
80781
|
+
"vat.small_business": "Gem\xE4\xDF \xA7 19 UStG wird keine Umsatzsteuer berechnet."
|
|
80782
|
+
}
|
|
80723
80783
|
}
|
|
80724
80784
|
},
|
|
80725
80785
|
{
|
|
@@ -80780,7 +80840,9 @@ ${loop(e, "line", "invoice.lines", ` <tr><td>${val(e, "line.description")}</t
|
|
|
80780
80840
|
<span>${tr(e, "footer.page")} <span class="pageNumber"></span> ${tr(e, "footer.of")} <span class="totalPages"></span></span>
|
|
80781
80841
|
</div>$0`
|
|
80782
80842
|
),
|
|
80783
|
-
sampleData: {
|
|
80843
|
+
sampleData: {
|
|
80844
|
+
company: { name: "Fennlor Studio GmbH", email: "hello@fennlor.example" }
|
|
80845
|
+
},
|
|
80784
80846
|
i18n: {
|
|
80785
80847
|
en: { "footer.page": "Page", "footer.of": "of" },
|
|
80786
80848
|
de: { "footer.page": "Seite", "footer.of": "von" }
|
|
@@ -80865,7 +80927,10 @@ ${loop(e, "line", "invoice.lines", ` <tr><td>${val(e, "line.description")}</t
|
|
|
80865
80927
|
},
|
|
80866
80928
|
i18n: {
|
|
80867
80929
|
en: { "qr.alt": "Payment QR code", "qr.caption": "Scan to pay" },
|
|
80868
|
-
de: {
|
|
80930
|
+
de: {
|
|
80931
|
+
"qr.alt": "QR-Code zur Zahlung",
|
|
80932
|
+
"qr.caption": "Zum Bezahlen scannen"
|
|
80933
|
+
}
|
|
80869
80934
|
},
|
|
80870
80935
|
sampleData: {
|
|
80871
80936
|
payment: {
|
|
@@ -80974,6 +81039,552 @@ var SEGMENT = "[A-Za-z0-9][A-Za-z0-9._-]*";
|
|
|
80974
81039
|
var ASSET_NAME_PATTERN = new RegExp(`^${SEGMENT}(?:/${SEGMENT})*$`);
|
|
80975
81040
|
var ASSET_MAX_BYTES = 10 * 1024 * 1024;
|
|
80976
81041
|
|
|
81042
|
+
// packages/engine/src/lib/generated/frames.ts
|
|
81043
|
+
var textEditRuntime = '"use strict";(()=>{var H=`\nhtml.ff-edit-mode [data-ff-edit] { cursor: text; }\nhtml.ff-edit-mode [data-ff-edit]:hover { outline: 1px dashed rgba(37,99,235,.85); outline-offset: 2px; }\nhtml.ff-edit-mode [data-ff-edit="t"]:hover { outline-color: rgba(147,51,234,.9); }\n.ff-editing { outline: 2px solid #2563eb !important; outline-offset: 2px; cursor: text; }\n.ff-editing .ff-chip { background: rgba(37,99,235,.14) !important; box-shadow: inset 0 0 0 1px rgba(37,99,235,.45) !important; border-radius: 3px !important; padding: 0 1px !important; cursor: default; }\n.ff-edit-badge { position: absolute; z-index: 2147483647; font: 500 11px/1.4 system-ui, sans-serif !important; color: #fff !important; background: #2563eb !important; padding: 1px 6px !important; border-radius: 4px !important; pointer-events: none; white-space: nowrap; }\n`;function R(s,l={}){let g=l.clicks!==!1,p=l.live===!0,o=s.document,i=null,a=null,c=e=>{try{s.parent.postMessage(e,"*")}catch{}},b=o.createElement("style");b.setAttribute("data-formfeed","edit"),b.setAttribute("data-pagedjs-ignore",""),b.textContent=H,(o.head??o.documentElement).appendChild(b),g&&o.documentElement.classList.add("ff-edit-mode");let D=e=>(e&&typeof e.closest=="function"?e:null)?.closest("[data-ff-edit]")??null;o.addEventListener("click",e=>{if(!g)return;if(i&&!i.done&&i.element.contains(e.target)){e.stopImmediatePropagation();return}let t=D(e.target);if(!t)return;e.preventDefault(),e.stopImmediatePropagation(),i&&!i.done&&y();let n=t.getAttribute("data-ff-src")??"",r=t.getBoundingClientRect();a={src:n,element:t,x:e.clientX,y:e.clientY},c({type:"formfeed:edit-request",src:n,edit:t.getAttribute("data-ff-edit"),text:t.textContent??"",count:o.querySelectorAll(`[data-ff-src="${n.replace(/"/g,"")}"]`).length,split:t.hasAttribute("data-split-from")||t.hasAttribute("data-split-to"),rect:{left:r.left,top:r.top,width:r.width,height:r.height}})},!0),o.addEventListener("keydown",e=>{if(!g||i&&!i.done||!(e.ctrlKey||e.metaKey)||e.altKey)return;let t=e.key.toLowerCase();(t==="z"||t==="y")&&(e.preventDefault(),c({type:t==="y"||e.shiftKey?"formfeed:redo":"formfeed:undo"}))}),s.addEventListener("message",e=>{if(e.source!==s.parent)return;let t=e.data;!t||typeof t.type!="string"||(t.type==="formfeed:edit-begin"?F(t):(t.type==="formfeed:edit-refuse"||t.type==="formfeed:edit-end")&&(a=null,i&&!i.done&&h(!1)))});function F(e){i&&!i.done&&h(!1);let t=e.layer?o.querySelector(`[data-ff-layer="${String(e.layer).replace(/"/g,"")}"] > .ff-text`):a&&a.src===e.src?a.element:o.querySelector(`[data-ff-src="${String(e.src).replace(/"/g,"")}"]`),n=e.at,r=e.layer?n&&Number.isFinite(n.x)&&Number.isFinite(n.y)?{x:Number(n.x),y:Number(n.y)}:null:a&&a.src===e.src?a:null;if(a=null,!t||!Array.isArray(e.items)){c({type:"formfeed:edit-cancel",token:String(e.token)});return}let m=Array.from(t.childNodes),f=o.createDocumentFragment();for(let u of e.items)if(u.kind==="text")f.appendChild(o.createTextNode(String(u.text)));else if(u.kind==="break")f.appendChild(o.createElement("br"));else if(u.kind==="chip"){let d=o.createElement("span");d.className="ff-chip",d.setAttribute("data-ff-chip",String(u.index)),d.setAttribute("contenteditable","false"),u.title&&(d.title=String(u.title)),d.textContent=String(u.text),f.appendChild(d)}for(let u of m)t.removeChild(u);t.appendChild(f),t.contentEditable="true",t.classList.add("ff-editing"),t.setAttribute("role","textbox"),e.label&&t.setAttribute("aria-label",String(e.label)),t.spellcheck=!0,i={token:String(e.token),element:t,saved:m,allowBreaks:e.allowBreaks===!0,badge:e.note?B(t,String(e.note)):null,done:!1},t.addEventListener("keydown",E),t.addEventListener("beforeinput",v),t.addEventListener("paste",C),t.addEventListener("drop",L),t.addEventListener("focusout",A),p&&t.addEventListener("input",x),t.focus(),e.select==="all"?w(t):P(t,r),c({type:"formfeed:edit-started",token:i.token}),typeof e.insert=="string"&&e.insert&&k(e.insert.replace(/\\r\\n?|\\n/g," "))}function k(e){if(typeof o.execCommand=="function"&&o.execCommand("insertText",!1,e))return;let t=s.getSelection(),n=t&&t.rangeCount?t.getRangeAt(0):null;n&&(n.deleteContents(),n.insertNode(o.createTextNode(e)),n.collapse(!1),p&&x())}function x(){i&&!i.done&&c({type:"formfeed:edit-input",token:i.token,items:S(i.element)})}function B(e,t){let n=o.createElement("div");n.className="ff-edit-badge",n.textContent=t;let r=e.getBoundingClientRect();return n.style.left=`${r.left+s.scrollX}px`,n.style.top=`${Math.max(0,r.top+s.scrollY-22)}px`,o.body.appendChild(n),n}function w(e){let t=s.getSelection();if(!t)return;let n=o.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}function P(e,t){let n=s.getSelection();if(!n)return;let r=null,m=o;if(t){if(m.caretRangeFromPoint)r=m.caretRangeFromPoint(t.x,t.y);else if(m.caretPositionFromPoint){let f=m.caretPositionFromPoint(t.x,t.y);f&&(r=o.createRange(),r.setStart(f.offsetNode,f.offset))}}if(!r||!e.contains(r.startContainer))r=o.createRange(),r.selectNodeContents(e),r.collapse(!1);else if(t){let f=r.startContainer,d=(f.nodeType===1?f:f.parentElement)?.closest("[data-ff-chip]")??null;if(d&&d!==e&&e.contains(d)){let N=d.getBoundingClientRect();r=o.createRange(),t.x<N.left+N.width/2?r.setStartBefore(d):r.setStartAfter(d),r.collapse(!0)}}n.removeAllRanges(),n.addRange(r)}function E(e){let t=e.key;t==="Escape"?(e.preventDefault(),h(!0)):t==="Enter"&&!e.shiftKey?(e.preventDefault(),y()):t==="Enter"?(e.preventDefault(),i?.allowBreaks&&M()):t==="Tab"?(e.preventDefault(),y()):(e.ctrlKey||e.metaKey)&&["b","i","u"].includes(t.toLowerCase())&&(e.preventDefault(),p&&i&&!e.altKey&&c({type:"formfeed:edit-style",token:i.token,key:t.toLowerCase()}))}function v(e){let t=e.inputType??"";(t.startsWith("format")||t==="insertFromDrop"||t==="insertParagraph"||t==="insertLineBreak")&&e.preventDefault()}function C(e){e.preventDefault(),k((e.clipboardData?.getData("text/plain")??"").replace(/\\r\\n?|\\n/g," "))}function L(e){e.preventDefault()}function A(){s.setTimeout(()=>{i&&!i.done&&(!o.hasFocus()||!i.element.contains(o.activeElement))&&y()},0)}function M(){let e=s.getSelection();if(!e||!e.rangeCount)return;let t=e.getRangeAt(0);t.deleteContents();let n=o.createElement("br");t.insertNode(n),n.nextSibling||n.parentNode?.appendChild(o.createElement("br"));let r=o.createRange();r.setStartAfter(n),r.collapse(!0),e.removeAllRanges(),e.addRange(r)}function T(e){e.done=!0;let t=e.element;t.removeEventListener("keydown",E),t.removeEventListener("beforeinput",v),t.removeEventListener("paste",C),t.removeEventListener("drop",L),t.removeEventListener("focusout",A),t.removeEventListener("input",x),t.removeAttribute("contenteditable"),t.removeAttribute("role"),t.removeAttribute("aria-label"),t.classList.remove("ff-editing"),e.badge?.remove(),i===e&&(i=null)}function y(){let e=i;if(!e||e.done)return;let t=S(e.element);T(e),c({type:"formfeed:edit-commit",token:e.token,items:t})}function h(e){let t=i;if(!t||t.done)return;let n=t.element;for(;n.firstChild;)n.removeChild(n.firstChild);for(let r of t.saved)n.appendChild(r);T(t),e&&c({type:"formfeed:edit-cancel",token:t.token})}}function S(s){let l=[],g=o=>{let i=l[l.length-1];i?.kind==="text"?i.text+=o:o&&l.push({kind:"text",text:o})},p=o=>{for(let i of Array.from(o.childNodes))if(i.nodeType===3)g(i.data);else if(i.nodeType===1){let a=i,c=a.getAttribute("data-ff-chip");c!==null?l.push({kind:"chip",index:Number(c)}):a.tagName==="BR"?l.push({kind:"break"}):((a.tagName==="DIV"||a.tagName==="P")&&l.length&&l.push({kind:"break"}),p(a))}};for(p(s);l[l.length-1]?.kind==="break";)l.pop();return l}R(window);})();';
|
|
81044
|
+
|
|
81045
|
+
// packages/engine/src/lib/preview.ts
|
|
81046
|
+
var textEditScript = `<script>${textEditRuntime.replace(/<\/script/gi, "<\\/script")}</script>`;
|
|
81047
|
+
|
|
81048
|
+
// packages/engine/src/lib/source-edit.ts
|
|
81049
|
+
var NBSP = String.fromCharCode(160);
|
|
81050
|
+
var BREAK = String.fromCharCode(57344);
|
|
81051
|
+
var REMOVED = String.fromCharCode(57345);
|
|
81052
|
+
var CHIP_OPEN = String.fromCharCode(57346);
|
|
81053
|
+
var CHIP_CLOSE = String.fromCharCode(57347);
|
|
81054
|
+
|
|
81055
|
+
// packages/engine/src/lib/design/types.ts
|
|
81056
|
+
var DESIGN_VERSION = 1;
|
|
81057
|
+
|
|
81058
|
+
// packages/engine/src/lib/design/parse.ts
|
|
81059
|
+
var DESIGN_LIMITS = {
|
|
81060
|
+
layers: 200,
|
|
81061
|
+
textPerLayer: 5e3,
|
|
81062
|
+
bytes: 256 * 1024
|
|
81063
|
+
};
|
|
81064
|
+
|
|
81065
|
+
// packages/engine/src/lib/design/fonts.ts
|
|
81066
|
+
var range = (from, to) => Array.from({ length: (to - from) / 100 + 1 }, (_2, i) => from + i * 100);
|
|
81067
|
+
var googleFonts = [
|
|
81068
|
+
{
|
|
81069
|
+
family: "Inter",
|
|
81070
|
+
category: "sans-serif",
|
|
81071
|
+
weights: range(100, 900),
|
|
81072
|
+
italic: true
|
|
81073
|
+
},
|
|
81074
|
+
{
|
|
81075
|
+
family: "Roboto",
|
|
81076
|
+
category: "sans-serif",
|
|
81077
|
+
weights: range(100, 900),
|
|
81078
|
+
italic: true
|
|
81079
|
+
},
|
|
81080
|
+
{
|
|
81081
|
+
family: "Open Sans",
|
|
81082
|
+
category: "sans-serif",
|
|
81083
|
+
weights: range(300, 800),
|
|
81084
|
+
italic: true
|
|
81085
|
+
},
|
|
81086
|
+
{
|
|
81087
|
+
family: "Lato",
|
|
81088
|
+
category: "sans-serif",
|
|
81089
|
+
weights: [100, 300, 400, 700, 900],
|
|
81090
|
+
italic: true
|
|
81091
|
+
},
|
|
81092
|
+
{
|
|
81093
|
+
family: "Montserrat",
|
|
81094
|
+
category: "sans-serif",
|
|
81095
|
+
weights: range(100, 900),
|
|
81096
|
+
italic: true
|
|
81097
|
+
},
|
|
81098
|
+
{
|
|
81099
|
+
family: "Poppins",
|
|
81100
|
+
category: "sans-serif",
|
|
81101
|
+
weights: range(100, 900),
|
|
81102
|
+
italic: true
|
|
81103
|
+
},
|
|
81104
|
+
{
|
|
81105
|
+
family: "Source Sans 3",
|
|
81106
|
+
category: "sans-serif",
|
|
81107
|
+
weights: range(200, 900),
|
|
81108
|
+
italic: true
|
|
81109
|
+
},
|
|
81110
|
+
{
|
|
81111
|
+
family: "Nunito",
|
|
81112
|
+
category: "sans-serif",
|
|
81113
|
+
weights: range(200, 900),
|
|
81114
|
+
italic: true
|
|
81115
|
+
},
|
|
81116
|
+
{
|
|
81117
|
+
family: "Raleway",
|
|
81118
|
+
category: "sans-serif",
|
|
81119
|
+
weights: range(100, 900),
|
|
81120
|
+
italic: true
|
|
81121
|
+
},
|
|
81122
|
+
{
|
|
81123
|
+
family: "Work Sans",
|
|
81124
|
+
category: "sans-serif",
|
|
81125
|
+
weights: range(100, 900),
|
|
81126
|
+
italic: true
|
|
81127
|
+
},
|
|
81128
|
+
{
|
|
81129
|
+
family: "DM Sans",
|
|
81130
|
+
category: "sans-serif",
|
|
81131
|
+
weights: range(100, 900),
|
|
81132
|
+
italic: true
|
|
81133
|
+
},
|
|
81134
|
+
{
|
|
81135
|
+
family: "Manrope",
|
|
81136
|
+
category: "sans-serif",
|
|
81137
|
+
weights: range(200, 800),
|
|
81138
|
+
italic: false
|
|
81139
|
+
},
|
|
81140
|
+
{
|
|
81141
|
+
family: "Rubik",
|
|
81142
|
+
category: "sans-serif",
|
|
81143
|
+
weights: range(300, 900),
|
|
81144
|
+
italic: true
|
|
81145
|
+
},
|
|
81146
|
+
{
|
|
81147
|
+
family: "Noto Sans",
|
|
81148
|
+
category: "sans-serif",
|
|
81149
|
+
weights: range(100, 900),
|
|
81150
|
+
italic: true
|
|
81151
|
+
},
|
|
81152
|
+
{
|
|
81153
|
+
family: "IBM Plex Sans",
|
|
81154
|
+
category: "sans-serif",
|
|
81155
|
+
weights: range(100, 700),
|
|
81156
|
+
italic: true
|
|
81157
|
+
},
|
|
81158
|
+
{
|
|
81159
|
+
family: "Space Grotesk",
|
|
81160
|
+
category: "sans-serif",
|
|
81161
|
+
weights: range(300, 700),
|
|
81162
|
+
italic: false
|
|
81163
|
+
},
|
|
81164
|
+
{
|
|
81165
|
+
family: "Outfit",
|
|
81166
|
+
category: "sans-serif",
|
|
81167
|
+
weights: range(100, 900),
|
|
81168
|
+
italic: false
|
|
81169
|
+
},
|
|
81170
|
+
{
|
|
81171
|
+
family: "Plus Jakarta Sans",
|
|
81172
|
+
category: "sans-serif",
|
|
81173
|
+
weights: range(200, 800),
|
|
81174
|
+
italic: true
|
|
81175
|
+
},
|
|
81176
|
+
{
|
|
81177
|
+
family: "Figtree",
|
|
81178
|
+
category: "sans-serif",
|
|
81179
|
+
weights: range(300, 900),
|
|
81180
|
+
italic: true
|
|
81181
|
+
},
|
|
81182
|
+
{
|
|
81183
|
+
family: "Karla",
|
|
81184
|
+
category: "sans-serif",
|
|
81185
|
+
weights: range(200, 800),
|
|
81186
|
+
italic: true
|
|
81187
|
+
},
|
|
81188
|
+
{
|
|
81189
|
+
family: "Barlow",
|
|
81190
|
+
category: "sans-serif",
|
|
81191
|
+
weights: range(100, 900),
|
|
81192
|
+
italic: true
|
|
81193
|
+
},
|
|
81194
|
+
{
|
|
81195
|
+
family: "Archivo",
|
|
81196
|
+
category: "sans-serif",
|
|
81197
|
+
weights: range(100, 900),
|
|
81198
|
+
italic: true
|
|
81199
|
+
},
|
|
81200
|
+
{
|
|
81201
|
+
family: "Oswald",
|
|
81202
|
+
category: "display",
|
|
81203
|
+
weights: range(200, 700),
|
|
81204
|
+
italic: false
|
|
81205
|
+
},
|
|
81206
|
+
{ family: "Bebas Neue", category: "display", weights: [400], italic: false },
|
|
81207
|
+
{ family: "Anton", category: "display", weights: [400], italic: false },
|
|
81208
|
+
{
|
|
81209
|
+
family: "Playfair Display",
|
|
81210
|
+
category: "serif",
|
|
81211
|
+
weights: range(400, 900),
|
|
81212
|
+
italic: true
|
|
81213
|
+
},
|
|
81214
|
+
{
|
|
81215
|
+
family: "Merriweather",
|
|
81216
|
+
category: "serif",
|
|
81217
|
+
weights: range(300, 900),
|
|
81218
|
+
italic: true
|
|
81219
|
+
},
|
|
81220
|
+
{ family: "Lora", category: "serif", weights: range(400, 700), italic: true },
|
|
81221
|
+
{
|
|
81222
|
+
family: "Libre Baskerville",
|
|
81223
|
+
category: "serif",
|
|
81224
|
+
weights: [400, 700],
|
|
81225
|
+
italic: true
|
|
81226
|
+
},
|
|
81227
|
+
{
|
|
81228
|
+
family: "Source Serif 4",
|
|
81229
|
+
category: "serif",
|
|
81230
|
+
weights: range(200, 900),
|
|
81231
|
+
italic: true
|
|
81232
|
+
},
|
|
81233
|
+
{
|
|
81234
|
+
family: "EB Garamond",
|
|
81235
|
+
category: "serif",
|
|
81236
|
+
weights: range(400, 800),
|
|
81237
|
+
italic: true
|
|
81238
|
+
},
|
|
81239
|
+
{
|
|
81240
|
+
family: "Cormorant Garamond",
|
|
81241
|
+
category: "serif",
|
|
81242
|
+
weights: range(300, 700),
|
|
81243
|
+
italic: true
|
|
81244
|
+
},
|
|
81245
|
+
{
|
|
81246
|
+
family: "DM Serif Display",
|
|
81247
|
+
category: "serif",
|
|
81248
|
+
weights: [400],
|
|
81249
|
+
italic: true
|
|
81250
|
+
},
|
|
81251
|
+
{
|
|
81252
|
+
family: "Fraunces",
|
|
81253
|
+
category: "serif",
|
|
81254
|
+
weights: range(100, 900),
|
|
81255
|
+
italic: true
|
|
81256
|
+
},
|
|
81257
|
+
{
|
|
81258
|
+
family: "Roboto Slab",
|
|
81259
|
+
category: "serif",
|
|
81260
|
+
weights: range(100, 900),
|
|
81261
|
+
italic: false
|
|
81262
|
+
},
|
|
81263
|
+
{
|
|
81264
|
+
family: "Zilla Slab",
|
|
81265
|
+
category: "serif",
|
|
81266
|
+
weights: [300, 400, 500, 600, 700],
|
|
81267
|
+
italic: true
|
|
81268
|
+
},
|
|
81269
|
+
{
|
|
81270
|
+
family: "JetBrains Mono",
|
|
81271
|
+
category: "monospace",
|
|
81272
|
+
weights: range(100, 800),
|
|
81273
|
+
italic: true
|
|
81274
|
+
},
|
|
81275
|
+
{
|
|
81276
|
+
family: "IBM Plex Mono",
|
|
81277
|
+
category: "monospace",
|
|
81278
|
+
weights: range(100, 700),
|
|
81279
|
+
italic: true
|
|
81280
|
+
},
|
|
81281
|
+
{
|
|
81282
|
+
family: "Space Mono",
|
|
81283
|
+
category: "monospace",
|
|
81284
|
+
weights: [400, 700],
|
|
81285
|
+
italic: true
|
|
81286
|
+
},
|
|
81287
|
+
{
|
|
81288
|
+
family: "Caveat",
|
|
81289
|
+
category: "handwriting",
|
|
81290
|
+
weights: range(400, 700),
|
|
81291
|
+
italic: false
|
|
81292
|
+
},
|
|
81293
|
+
{
|
|
81294
|
+
family: "Pacifico",
|
|
81295
|
+
category: "handwriting",
|
|
81296
|
+
weights: [400],
|
|
81297
|
+
italic: false
|
|
81298
|
+
},
|
|
81299
|
+
{
|
|
81300
|
+
family: "Dancing Script",
|
|
81301
|
+
category: "handwriting",
|
|
81302
|
+
weights: range(400, 700),
|
|
81303
|
+
italic: false
|
|
81304
|
+
}
|
|
81305
|
+
];
|
|
81306
|
+
var byFamily = new Map(googleFonts.map((font) => [font.family, font]));
|
|
81307
|
+
|
|
81308
|
+
// packages/engine/src/lib/design/starters.ts
|
|
81309
|
+
var style = (overrides) => ({
|
|
81310
|
+
font: { family: "Inter", source: "google" },
|
|
81311
|
+
weight: 600,
|
|
81312
|
+
size: 40,
|
|
81313
|
+
lineHeight: 1.2,
|
|
81314
|
+
letterSpacing: 0,
|
|
81315
|
+
color: { color: "#111827" },
|
|
81316
|
+
align: "left",
|
|
81317
|
+
...overrides
|
|
81318
|
+
});
|
|
81319
|
+
var text = (layer) => ({
|
|
81320
|
+
type: "text",
|
|
81321
|
+
rotation: 0,
|
|
81322
|
+
opacity: 1,
|
|
81323
|
+
visible: true,
|
|
81324
|
+
sizing: "fixed",
|
|
81325
|
+
valign: "top",
|
|
81326
|
+
...layer
|
|
81327
|
+
});
|
|
81328
|
+
var design = (background, layers) => ({
|
|
81329
|
+
version: DESIGN_VERSION,
|
|
81330
|
+
output: "",
|
|
81331
|
+
background,
|
|
81332
|
+
layers
|
|
81333
|
+
});
|
|
81334
|
+
var designStarters = [
|
|
81335
|
+
{
|
|
81336
|
+
id: "blank",
|
|
81337
|
+
title: "Blank",
|
|
81338
|
+
size: { width: 1200, height: 630 },
|
|
81339
|
+
design: design({ color: "#ffffff" }, []),
|
|
81340
|
+
sampleData: {}
|
|
81341
|
+
},
|
|
81342
|
+
{
|
|
81343
|
+
id: "article",
|
|
81344
|
+
title: "Article card",
|
|
81345
|
+
size: { width: 1200, height: 630 },
|
|
81346
|
+
design: design({ brand: "primary", fallback: "#0f172a" }, [
|
|
81347
|
+
text({
|
|
81348
|
+
id: "site",
|
|
81349
|
+
name: "Site",
|
|
81350
|
+
x: 80,
|
|
81351
|
+
y: 64,
|
|
81352
|
+
width: 1040,
|
|
81353
|
+
height: 40,
|
|
81354
|
+
content: [{ path: "site.name" }],
|
|
81355
|
+
style: style({
|
|
81356
|
+
size: 26,
|
|
81357
|
+
weight: 600,
|
|
81358
|
+
letterSpacing: 2,
|
|
81359
|
+
uppercase: true,
|
|
81360
|
+
color: { color: "#cbd5e1" }
|
|
81361
|
+
})
|
|
81362
|
+
}),
|
|
81363
|
+
text({
|
|
81364
|
+
id: "title",
|
|
81365
|
+
name: "Title",
|
|
81366
|
+
x: 80,
|
|
81367
|
+
y: 130,
|
|
81368
|
+
width: 1040,
|
|
81369
|
+
height: 320,
|
|
81370
|
+
content: [{ path: "post.title" }],
|
|
81371
|
+
sizing: "shrink",
|
|
81372
|
+
minFontSize: 40,
|
|
81373
|
+
valign: "middle",
|
|
81374
|
+
style: style({
|
|
81375
|
+
size: 76,
|
|
81376
|
+
weight: 800,
|
|
81377
|
+
lineHeight: 1.1,
|
|
81378
|
+
color: { color: "#ffffff" }
|
|
81379
|
+
})
|
|
81380
|
+
}),
|
|
81381
|
+
{
|
|
81382
|
+
id: "rule",
|
|
81383
|
+
name: "Rule",
|
|
81384
|
+
type: "shape",
|
|
81385
|
+
shape: "rectangle",
|
|
81386
|
+
x: 80,
|
|
81387
|
+
y: 478,
|
|
81388
|
+
width: 120,
|
|
81389
|
+
height: 6,
|
|
81390
|
+
rotation: 0,
|
|
81391
|
+
opacity: 1,
|
|
81392
|
+
visible: true,
|
|
81393
|
+
fill: { brand: "accent", fallback: "#38bdf8" }
|
|
81394
|
+
},
|
|
81395
|
+
text({
|
|
81396
|
+
id: "byline",
|
|
81397
|
+
name: "Byline",
|
|
81398
|
+
x: 80,
|
|
81399
|
+
y: 508,
|
|
81400
|
+
width: 1040,
|
|
81401
|
+
height: 50,
|
|
81402
|
+
content: [{ text: "By " }, { path: "post.author" }],
|
|
81403
|
+
showWhen: { path: "post.author" },
|
|
81404
|
+
style: style({ size: 30, weight: 500, color: { color: "#cbd5e1" } })
|
|
81405
|
+
})
|
|
81406
|
+
]),
|
|
81407
|
+
sampleData: {
|
|
81408
|
+
site: { name: "Fennlor Studio" },
|
|
81409
|
+
post: {
|
|
81410
|
+
title: "How we cut our invoice run from an hour to four minutes",
|
|
81411
|
+
author: "Max Mustermann"
|
|
81412
|
+
}
|
|
81413
|
+
}
|
|
81414
|
+
},
|
|
81415
|
+
{
|
|
81416
|
+
id: "quote",
|
|
81417
|
+
title: "Quote card",
|
|
81418
|
+
size: { width: 1080, height: 1080 },
|
|
81419
|
+
design: design({ color: "#f5efe6" }, [
|
|
81420
|
+
text({
|
|
81421
|
+
id: "mark",
|
|
81422
|
+
name: "Quotation mark",
|
|
81423
|
+
x: 96,
|
|
81424
|
+
y: 60,
|
|
81425
|
+
width: 240,
|
|
81426
|
+
height: 220,
|
|
81427
|
+
content: [{ text: "\u201C" }],
|
|
81428
|
+
style: style({
|
|
81429
|
+
font: { family: "Playfair Display", source: "google" },
|
|
81430
|
+
size: 220,
|
|
81431
|
+
weight: 700,
|
|
81432
|
+
lineHeight: 1,
|
|
81433
|
+
color: { color: "#d97706" }
|
|
81434
|
+
})
|
|
81435
|
+
}),
|
|
81436
|
+
text({
|
|
81437
|
+
id: "quote",
|
|
81438
|
+
name: "Quote",
|
|
81439
|
+
x: 96,
|
|
81440
|
+
y: 260,
|
|
81441
|
+
width: 888,
|
|
81442
|
+
height: 520,
|
|
81443
|
+
content: [{ path: "review.quote" }],
|
|
81444
|
+
sizing: "shrink",
|
|
81445
|
+
minFontSize: 32,
|
|
81446
|
+
valign: "middle",
|
|
81447
|
+
style: style({
|
|
81448
|
+
font: { family: "Playfair Display", source: "google" },
|
|
81449
|
+
size: 60,
|
|
81450
|
+
weight: 600,
|
|
81451
|
+
lineHeight: 1.22,
|
|
81452
|
+
color: { color: "#1c1917" }
|
|
81453
|
+
})
|
|
81454
|
+
}),
|
|
81455
|
+
text({
|
|
81456
|
+
id: "author",
|
|
81457
|
+
name: "Author",
|
|
81458
|
+
x: 96,
|
|
81459
|
+
y: 836,
|
|
81460
|
+
width: 888,
|
|
81461
|
+
height: 50,
|
|
81462
|
+
content: [{ path: "review.author" }],
|
|
81463
|
+
style: style({ size: 36, weight: 600, color: { color: "#1c1917" } })
|
|
81464
|
+
}),
|
|
81465
|
+
text({
|
|
81466
|
+
id: "role",
|
|
81467
|
+
name: "Role",
|
|
81468
|
+
x: 96,
|
|
81469
|
+
y: 896,
|
|
81470
|
+
width: 888,
|
|
81471
|
+
height: 44,
|
|
81472
|
+
content: [{ path: "review.role" }],
|
|
81473
|
+
showWhen: { path: "review.role" },
|
|
81474
|
+
style: style({ size: 28, weight: 400, color: { color: "#78716c" } })
|
|
81475
|
+
})
|
|
81476
|
+
]),
|
|
81477
|
+
sampleData: {
|
|
81478
|
+
review: {
|
|
81479
|
+
quote: "Delivery took two days, and the one shade that arrived dented was replaced before we had finished the call.",
|
|
81480
|
+
author: "Erika Mustermann",
|
|
81481
|
+
role: "Office manager, Olvarest GmbH"
|
|
81482
|
+
}
|
|
81483
|
+
}
|
|
81484
|
+
},
|
|
81485
|
+
{
|
|
81486
|
+
id: "event",
|
|
81487
|
+
title: "Event story",
|
|
81488
|
+
size: { width: 1080, height: 1920 },
|
|
81489
|
+
design: design({ color: "#111827" }, [
|
|
81490
|
+
text({
|
|
81491
|
+
id: "label",
|
|
81492
|
+
name: "Label",
|
|
81493
|
+
x: 96,
|
|
81494
|
+
y: 200,
|
|
81495
|
+
width: 888,
|
|
81496
|
+
height: 50,
|
|
81497
|
+
content: [{ text: "Event" }],
|
|
81498
|
+
style: style({
|
|
81499
|
+
size: 36,
|
|
81500
|
+
weight: 700,
|
|
81501
|
+
letterSpacing: 6,
|
|
81502
|
+
uppercase: true,
|
|
81503
|
+
color: { color: "#fbbf24" }
|
|
81504
|
+
})
|
|
81505
|
+
}),
|
|
81506
|
+
text({
|
|
81507
|
+
id: "title",
|
|
81508
|
+
name: "Title",
|
|
81509
|
+
x: 96,
|
|
81510
|
+
y: 290,
|
|
81511
|
+
width: 888,
|
|
81512
|
+
height: 620,
|
|
81513
|
+
content: [{ path: "event.title" }],
|
|
81514
|
+
sizing: "shrink",
|
|
81515
|
+
minFontSize: 56,
|
|
81516
|
+
valign: "bottom",
|
|
81517
|
+
style: style({
|
|
81518
|
+
size: 112,
|
|
81519
|
+
weight: 800,
|
|
81520
|
+
lineHeight: 1.05,
|
|
81521
|
+
color: { color: "#ffffff" }
|
|
81522
|
+
})
|
|
81523
|
+
}),
|
|
81524
|
+
text({
|
|
81525
|
+
id: "date",
|
|
81526
|
+
name: "Date",
|
|
81527
|
+
x: 96,
|
|
81528
|
+
y: 980,
|
|
81529
|
+
width: 888,
|
|
81530
|
+
height: 70,
|
|
81531
|
+
content: [
|
|
81532
|
+
{
|
|
81533
|
+
path: "event.date",
|
|
81534
|
+
format: { helper: "date", pattern: "d MMMM yyyy" }
|
|
81535
|
+
}
|
|
81536
|
+
],
|
|
81537
|
+
style: style({ size: 52, weight: 600, color: { color: "#e5e7eb" } })
|
|
81538
|
+
}),
|
|
81539
|
+
text({
|
|
81540
|
+
id: "place",
|
|
81541
|
+
name: "Place",
|
|
81542
|
+
x: 96,
|
|
81543
|
+
y: 1060,
|
|
81544
|
+
width: 888,
|
|
81545
|
+
height: 60,
|
|
81546
|
+
content: [{ path: "event.place" }],
|
|
81547
|
+
style: style({ size: 38, weight: 400, color: { color: "#9ca3af" } })
|
|
81548
|
+
}),
|
|
81549
|
+
{
|
|
81550
|
+
id: "qr",
|
|
81551
|
+
name: "QR code",
|
|
81552
|
+
type: "qr",
|
|
81553
|
+
x: 96,
|
|
81554
|
+
y: 1440,
|
|
81555
|
+
width: 300,
|
|
81556
|
+
height: 300,
|
|
81557
|
+
rotation: 0,
|
|
81558
|
+
opacity: 1,
|
|
81559
|
+
visible: true,
|
|
81560
|
+
radius: 16,
|
|
81561
|
+
value: { path: "event.url" },
|
|
81562
|
+
ecc: "M",
|
|
81563
|
+
color: { color: "#111827" },
|
|
81564
|
+
background: { color: "#ffffff" }
|
|
81565
|
+
},
|
|
81566
|
+
text({
|
|
81567
|
+
id: "scan",
|
|
81568
|
+
name: "Scan note",
|
|
81569
|
+
x: 440,
|
|
81570
|
+
y: 1560,
|
|
81571
|
+
width: 544,
|
|
81572
|
+
height: 60,
|
|
81573
|
+
content: [{ text: "Scan for your ticket" }],
|
|
81574
|
+
style: style({ size: 40, weight: 600, color: { color: "#ffffff" } })
|
|
81575
|
+
})
|
|
81576
|
+
]),
|
|
81577
|
+
sampleData: {
|
|
81578
|
+
event: {
|
|
81579
|
+
title: "Formfeed meetup: documents as code",
|
|
81580
|
+
date: "2026-11-12",
|
|
81581
|
+
place: "Musterstra\xDFe 1 \xB7 12345 Musterstadt",
|
|
81582
|
+
url: "https://fennlor.test/events/meetup"
|
|
81583
|
+
}
|
|
81584
|
+
}
|
|
81585
|
+
}
|
|
81586
|
+
];
|
|
81587
|
+
|
|
80977
81588
|
// packages/engine/src/lib/office/errors.ts
|
|
80978
81589
|
var officeLimits = {
|
|
80979
81590
|
/** Entries in one container. */
|
|
@@ -81416,10 +82027,10 @@ var Formfeed = class {
|
|
|
81416
82027
|
}
|
|
81417
82028
|
if (res.status === 204) return { status: 204, body: void 0 };
|
|
81418
82029
|
if (as === "bytes" && res.ok) return { status: res.status, body: new Uint8Array(await res.arrayBuffer()) };
|
|
81419
|
-
const
|
|
82030
|
+
const text3 = await res.text();
|
|
81420
82031
|
let json2 = null;
|
|
81421
82032
|
try {
|
|
81422
|
-
json2 =
|
|
82033
|
+
json2 = text3 ? JSON.parse(text3) : null;
|
|
81423
82034
|
} catch {
|
|
81424
82035
|
if (res.ok) throw new FormfeedError("invalid_response", `the API answered HTTP ${res.status} with a body that is not JSON`, res.status);
|
|
81425
82036
|
}
|
|
@@ -81449,7 +82060,7 @@ var encoder2 = new TextEncoder();
|
|
|
81449
82060
|
// packages/mcp/src/lib/server.ts
|
|
81450
82061
|
import { z as z2 } from "zod";
|
|
81451
82062
|
var CONVERT_LIMIT_BYTES = 20 * 1024 * 1024;
|
|
81452
|
-
var SERVER_INFO = { name: "formfeed", version: "0.3.
|
|
82063
|
+
var SERVER_INFO = { name: "formfeed", version: "0.3.11" };
|
|
81453
82064
|
var READS = { readOnlyHint: true, destructiveHint: false, openWorldHint: false };
|
|
81454
82065
|
var CREATES = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
|
|
81455
82066
|
var engineSchema = z2.enum(["jinja2", "liquid", "handlebars"]);
|
|
@@ -81477,7 +82088,7 @@ var renderSummary = (r) => ({
|
|
|
81477
82088
|
template: r.template,
|
|
81478
82089
|
error: r.error
|
|
81479
82090
|
});
|
|
81480
|
-
function
|
|
82091
|
+
function text2(data) {
|
|
81481
82092
|
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }], structuredContent: data };
|
|
81482
82093
|
}
|
|
81483
82094
|
function failure(e) {
|
|
@@ -81511,7 +82122,7 @@ function createFormfeedServer(options) {
|
|
|
81511
82122
|
async (args2) => {
|
|
81512
82123
|
try {
|
|
81513
82124
|
const templates = await client.templates.all(args2);
|
|
81514
|
-
return
|
|
82125
|
+
return text2({ templates: templates.map(templateSummary) });
|
|
81515
82126
|
} catch (e) {
|
|
81516
82127
|
return failure(e);
|
|
81517
82128
|
}
|
|
@@ -81532,7 +82143,7 @@ function createFormfeedServer(options) {
|
|
|
81532
82143
|
throw e;
|
|
81533
82144
|
});
|
|
81534
82145
|
const schema = version.data_schema ?? inferSchema(version.sample_data ?? {});
|
|
81535
|
-
return
|
|
82146
|
+
return text2({ template, version: version.number, status: version.status, schema, sample_data: version.sample_data ?? {} });
|
|
81536
82147
|
} catch (e) {
|
|
81537
82148
|
return failure(e);
|
|
81538
82149
|
}
|
|
@@ -81559,7 +82170,7 @@ function createFormfeedServer(options) {
|
|
|
81559
82170
|
if (e.status === 404) return check("latest");
|
|
81560
82171
|
throw e;
|
|
81561
82172
|
});
|
|
81562
|
-
return
|
|
82173
|
+
return text2({
|
|
81563
82174
|
ok: result.ok,
|
|
81564
82175
|
template: result.template,
|
|
81565
82176
|
diagnostics: result.diagnostics.map((d) => ({
|
|
@@ -81581,7 +82192,7 @@ function createFormfeedServer(options) {
|
|
|
81581
82192
|
diagnostics.push({ severity: "error", code: "syntax-error", message: e instanceof Error ? e.message : String(e), range: { start: { line: 1, column: 1 }, end: { line: 1, column: 2 } } });
|
|
81582
82193
|
}
|
|
81583
82194
|
diagnostics.push(...eng.analyze(html, { sampleData: data ?? {} }).diagnostics);
|
|
81584
|
-
return
|
|
82195
|
+
return text2({
|
|
81585
82196
|
ok: !diagnostics.some((d) => d.severity === "error"),
|
|
81586
82197
|
diagnostics: diagnostics.map((d) => ({ severity: d.severity, code: d.code, message: d.message, line: d.range.start.line, column: d.range.start.column }))
|
|
81587
82198
|
});
|
|
@@ -81623,7 +82234,7 @@ function createFormfeedServer(options) {
|
|
|
81623
82234
|
meta: { source: "mcp" }
|
|
81624
82235
|
});
|
|
81625
82236
|
if (wait && render.status !== "succeeded" && render.status !== "failed") render = await client.renders.waitFor(render.id);
|
|
81626
|
-
return
|
|
82237
|
+
return text2(renderSummary(render));
|
|
81627
82238
|
} catch (e) {
|
|
81628
82239
|
return failure(e);
|
|
81629
82240
|
}
|
|
@@ -81687,7 +82298,7 @@ function createFormfeedServer(options) {
|
|
|
81687
82298
|
render = await client.pdf.convert({ file: { data, name } }, { ...convert, ...filename ? {} : { filename: `${name.replace(/\.[^.]+$/, "")}.pdf` } });
|
|
81688
82299
|
}
|
|
81689
82300
|
if (render.status !== "succeeded" && render.status !== "failed") render = await client.renders.waitFor(render.id);
|
|
81690
|
-
return
|
|
82301
|
+
return text2(renderSummary(render));
|
|
81691
82302
|
} catch (e) {
|
|
81692
82303
|
return failure(e);
|
|
81693
82304
|
}
|
|
@@ -81703,7 +82314,7 @@ function createFormfeedServer(options) {
|
|
|
81703
82314
|
},
|
|
81704
82315
|
async ({ id }) => {
|
|
81705
82316
|
try {
|
|
81706
|
-
return
|
|
82317
|
+
return text2(renderSummary(await client.renders.get(id)));
|
|
81707
82318
|
} catch (e) {
|
|
81708
82319
|
return failure(e);
|
|
81709
82320
|
}
|