@aglyn/plugins-ai 1.15.0 → 1.15.2
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/package.json +17 -17
- package/src/lib/components/ai-site-import-start.component.js +3 -1
- package/src/lib/components/ai-site-import-start.component.js.map +1 -1
- package/src/lib/jobs/ai-job-import-step.d.ts +18 -2
- package/src/lib/jobs/ai-job-import-step.js +24 -8
- package/src/lib/jobs/ai-job-import-step.js.map +1 -1
- package/src/lib/jobs/ai-job-page-language.d.ts +2 -0
- package/src/lib/jobs/ai-job-page-language.js +72 -37
- package/src/lib/jobs/ai-job-page-language.js.map +1 -1
- package/src/lib/jobs/ai-job-page-step.js +5 -3
- package/src/lib/jobs/ai-job-page-step.js.map +1 -1
- package/src/lib/jobs/ai-job-text-step.d.ts +1 -0
- package/src/lib/jobs/ai-job-text-step.js.map +1 -1
- package/src/lib/jobs/ai-site-import-compile.js +26 -1
- package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
- package/src/lib/jobs/ai-site-import-improve.d.ts +59 -6
- package/src/lib/jobs/ai-site-import-improve.js +149 -19
- package/src/lib/jobs/ai-site-import-improve.js.map +1 -1
- package/src/lib/jobs/ai-site-import-plan.js +1 -1
- package/src/lib/jobs/ai-site-import-plan.js.map +1 -1
- package/src/lib/model/ai-credit-estimate.d.ts +16 -0
- package/src/lib/model/ai-credit-estimate.js +14 -0
- package/src/lib/model/ai-credit-estimate.js.map +1 -1
- package/src/lib/model/ai-site-import-fidelity.d.ts +2 -0
- package/src/lib/model/ai-site-import-fidelity.js +7 -1
- package/src/lib/model/ai-site-import-fidelity.js.map +1 -1
- package/src/lib/model/ai-site-import-view.d.ts +3 -1
- package/src/lib/model/ai-site-import-view.js +8 -3
- package/src/lib/model/ai-site-import-view.js.map +1 -1
- package/src/lib/model/ai-site-import.d.ts +27 -2
- package/src/lib/model/ai-site-import.js +63 -14
- package/src/lib/model/ai-site-import.js.map +1 -1
|
@@ -434,6 +434,19 @@ const OPEN_STYLES = new Set([
|
|
|
434
434
|
scope.used.add(ref);
|
|
435
435
|
return block.kind === 'image' ? '' : clean(block.text);
|
|
436
436
|
}
|
|
437
|
+
/**
|
|
438
|
+
* The link a short paragraph is the words of (AGL-4152), where a generative
|
|
439
|
+
* redesign draws it: a source that wraps a button's label in a paragraph
|
|
440
|
+
* reads as that paragraph and then the same words as an inline link to where
|
|
441
|
+
* the button goes. `null` for any other line, and on every other page.
|
|
442
|
+
*/ function labelOfLink(scope, ref) {
|
|
443
|
+
if (scope.doc.generative !== true || scope.used.has(ref)) return null;
|
|
444
|
+
const block = scope.doc.blocks[ref];
|
|
445
|
+
const next = scope.doc.blocks[ref + 1];
|
|
446
|
+
if ((block == null ? void 0 : block.kind) !== 'paragraph' || (next == null ? void 0 : next.kind) !== 'link' || !next.inline || !next.href) return null;
|
|
447
|
+
const text = clean(block.text);
|
|
448
|
+
return text && text.length <= AI_SITE_IMPORT_LABEL_CHARS && clean(next.text) === text ? next : null;
|
|
449
|
+
}
|
|
437
450
|
/** A width over a height as `aspect-ratio` writes it: "1600 / 900", or "1.7778" for a ratio alone. */ function ratioText(width, height = 1) {
|
|
438
451
|
const round = (value)=>String(Math.round(value * 10000) / 10000);
|
|
439
452
|
return height === 1 ? round(width) : `${round(width)} / ${round(height)}`;
|
|
@@ -742,8 +755,20 @@ const HEX = /^#[0-9a-f]{6}$/i;
|
|
|
742
755
|
];
|
|
743
756
|
} else if (((_item_link1 = item.link) == null ? void 0 : _item_link1.includes(ref)) || block.kind === 'link' && (!named.has(ref) || clean(block.text).length <= AI_SITE_IMPORT_LABEL_CHARS)) addLink(ref);
|
|
744
757
|
else {
|
|
758
|
+
var _ref;
|
|
759
|
+
var _item_ctas_find, _item_ctas;
|
|
760
|
+
// A button the source wraps its words in reads as a paragraph with its link after it (AGL-4152): a call to action, never a line of text.
|
|
761
|
+
const button = labelOfLink(scope, ref);
|
|
745
762
|
const line = take(scope, ref);
|
|
746
|
-
|
|
763
|
+
const to = button ? aiSiteImportLinkTo(scope, button.href) : undefined;
|
|
764
|
+
if (button && line) links.push(_extends({
|
|
765
|
+
text: line
|
|
766
|
+
}, to ? {
|
|
767
|
+
to
|
|
768
|
+
} : {}, {
|
|
769
|
+
style: (_ref = (_item_ctas = item.ctas) == null ? void 0 : (_item_ctas_find = _item_ctas.find((cta)=>cta.line === ref)) == null ? void 0 : _item_ctas_find.style) != null ? _ref : 'secondary'
|
|
770
|
+
}));
|
|
771
|
+
else if (line) paragraphs.push(...aiSiteImportTextParts(line));
|
|
747
772
|
}
|
|
748
773
|
}
|
|
749
774
|
if (paragraphs.length) out.text = paragraphs[0];
|