@aglyn/plugins-ai 1.10.0 → 1.12.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/package.json +17 -17
- package/src/lib/jobs/ai-job-import-step.d.ts +1 -1
- package/src/lib/jobs/ai-job-import-step.js +26 -7
- package/src/lib/jobs/ai-job-import-step.js.map +1 -1
- package/src/lib/jobs/ai-job-privacy-step.js +2 -2
- package/src/lib/jobs/ai-job-privacy-step.js.map +1 -1
- package/src/lib/jobs/ai-site-import-compile.js +27 -37
- package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
- package/src/lib/jobs/ai-site-import-look.js +20 -1
- package/src/lib/jobs/ai-site-import-look.js.map +1 -1
- package/src/lib/layout-language/ai-layout-compiler.js +7 -1
- package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
- package/src/lib/model/ai-credit-estimate.d.ts +15 -0
- package/src/lib/model/ai-credit-estimate.js +13 -0
- package/src/lib/model/ai-credit-estimate.js.map +1 -1
- package/src/lib/model/ai-site-import-fidelity.d.ts +46 -3
- package/src/lib/model/ai-site-import-fidelity.js +254 -62
- package/src/lib/model/ai-site-import-fidelity.js.map +1 -1
- package/src/lib/model/ai-site-import-report.d.ts +7 -0
- package/src/lib/model/ai-site-import-report.js +17 -5
- package/src/lib/model/ai-site-import-report.js.map +1 -1
- package/src/lib/model/ai-site-import.d.ts +46 -3
- package/src/lib/model/ai-site-import.js +34 -11
- package/src/lib/model/ai-site-import.js.map +1 -1
- package/src/lib/model/ai-site-look.d.ts +16 -0
- package/src/lib/model/ai-site-look.js +76 -14
- package/src/lib/model/ai-site-look.js.map +1 -1
- package/src/lib/site-import/fixtures/aglyn-com-recordings.d.ts +2 -1
- package/src/lib/site-import/fixtures/aglyn-com-recordings.js +3 -2
- package/src/lib/site-import/fixtures/aglyn-com-recordings.js.map +1 -1
- package/src/lib/site-import/fixtures/site-import-crawl-recordings.d.ts +5 -0
- package/src/lib/site-import/fixtures/site-import-crawl-recordings.js +116 -3
- package/src/lib/site-import/fixtures/site-import-crawl-recordings.js.map +1 -1
- package/src/lib/site-import/fixtures/site-import-fidelity-replay.d.ts +7 -0
- package/src/lib/site-import/fixtures/site-import-fidelity-replay.js +15 -0
- package/src/lib/site-import/fixtures/site-import-fidelity-replay.js.map +1 -1
- package/src/lib/site-import/fixtures/site-layout-recordings.js +4 -3
- package/src/lib/site-import/fixtures/site-layout-recordings.js.map +1 -1
- package/src/lib/site-import/fixtures/site-look-slate.d.ts +2 -1
- package/src/lib/site-import/fixtures/site-look-slate.js +2 -1
- package/src/lib/site-import/fixtures/site-look-slate.js.map +1 -1
- package/src/lib/site-import/site-import-crawl.d.ts +7 -1
- package/src/lib/site-import/site-import-crawl.js +101 -6
- package/src/lib/site-import/site-import-crawl.js.map +1 -1
- package/src/lib/site-import/site-import-css.d.ts +8 -1
- package/src/lib/site-import/site-import-css.js +30 -8
- package/src/lib/site-import/site-import-css.js.map +1 -1
- package/src/lib/site-import/site-import-html.d.ts +2 -0
- package/src/lib/site-import/site-import-html.js +3 -0
- package/src/lib/site-import/site-import-html.js.map +1 -1
- package/src/lib/site-import/site-import-layout.d.ts +9 -2
- package/src/lib/site-import/site-import-layout.js +104 -30
- package/src/lib/site-import/site-import-layout.js.map +1 -1
- package/src/lib/site-import/site-import-page.js +5 -0
- package/src/lib/site-import/site-import-page.js.map +1 -1
- package/src/lib/site-import/site-import-same-page.d.ts +41 -0
- package/src/lib/site-import/site-import-same-page.js +108 -0
- package/src/lib/site-import/site-import-same-page.js.map +1 -0
|
@@ -113,6 +113,14 @@ export interface AiSiteStyle {
|
|
|
113
113
|
* white reads on it. Absent, the dark scheme's own.
|
|
114
114
|
*/
|
|
115
115
|
darkPage?: string;
|
|
116
|
+
/**
|
|
117
|
+
* The fill a site brought in draws its set-apart bands on, `#rrggbb`
|
|
118
|
+
* (AGL-4152), kept by Keep my site as the light scheme's paper where the
|
|
119
|
+
* theme's text reads on it. Absent, the ground's own paper.
|
|
120
|
+
*/
|
|
121
|
+
paper?: string;
|
|
122
|
+
/** The same bands' fill in its dark scheme, `#rrggbb`, where its stylesheets say one (AGL-4152). Absent, a step above the dark page. */
|
|
123
|
+
darkPaper?: string;
|
|
116
124
|
/**
|
|
117
125
|
* A site brought in's button case (AGL-4152), kept by Keep my site: the
|
|
118
126
|
* button Text Style in capitals, or not. Absent, the buttons' own style
|
|
@@ -129,6 +137,14 @@ export interface AiSiteStyle {
|
|
|
129
137
|
buttonFill?: string;
|
|
130
138
|
/** The words' color on {@link AiSiteStyle.buttonFill}, `#rrggbb`, as the source draws them (AGL-4152). */
|
|
131
139
|
buttonText?: string;
|
|
140
|
+
/** The case a site brought in sets its outlined buttons in (AGL-4152), kept by Keep my site where it differs from its filled buttons'. */
|
|
141
|
+
outlinedCase?: 'upper' | 'none';
|
|
142
|
+
/** The case a site brought in sets its text buttons in (AGL-4152), kept the same way. */
|
|
143
|
+
textCase?: 'upper' | 'none';
|
|
144
|
+
/** The fill a site brought in's outlined buttons set, `#rrggbb` (AGL-4152). Absent, Keep my site draws them with none of their own. */
|
|
145
|
+
outlinedFill?: string;
|
|
146
|
+
/** The words' color on a site brought in's outlined buttons, `#rrggbb` (AGL-4152): a grey or a black draws them in the theme's words, any other color in the primary. */
|
|
147
|
+
buttonOutline?: string;
|
|
132
148
|
/**
|
|
133
149
|
* A site brought in's own type (AGL-4108): the families its source sets
|
|
134
150
|
* its body and its headings in, where the theme font catalog has them,
|
|
@@ -768,6 +768,10 @@ const SOLID = /^#[0-9a-f]{6}$/i;
|
|
|
768
768
|
const ink = aiOklchHex(0.2, 0.04, h);
|
|
769
769
|
return ratio(white, fill) >= 4.5 ? white : ratio(ink, fill) >= 4.5 ? ink : ratio(white, fill) > ratio(ink, fill) ? white : '#000000';
|
|
770
770
|
}
|
|
771
|
+
/** The label a fill carries whose own words have no shade on their side that reads on it (AGL-4152): {@link labelOn}'s, else black or white, one of which always reads. */ function crossedLabelOn(fill) {
|
|
772
|
+
const own = labelOn(fill, aiHexOklch(fill).h);
|
|
773
|
+
return ratio(own, fill) >= 4.5 ? own : ratio('#000000', fill) >= ratio('#ffffff', fill) ? '#000000' : '#ffffff';
|
|
774
|
+
}
|
|
771
775
|
/** How far apart two hues sit on the wheel, in degrees: 0 to 180. */ export function aiHueGap(a, b) {
|
|
772
776
|
const d = Math.abs(a - b) % 360;
|
|
773
777
|
return Math.min(d, 360 - d);
|
|
@@ -805,7 +809,7 @@ const START_L = {
|
|
|
805
809
|
return colorsOf(style).button;
|
|
806
810
|
}
|
|
807
811
|
function colorsOf(style) {
|
|
808
|
-
var _ref, _ref1, _ref2, _ref3;
|
|
812
|
+
var _ref, _ref1, _ref2, _ref3, _shadeOn;
|
|
809
813
|
const next = random(style.seed ^ 0x9e3779b9);
|
|
810
814
|
const neutral = style.chroma === 'neutral';
|
|
811
815
|
const brand = style.brand ? aiHexOklch(style.brand) : null;
|
|
@@ -862,7 +866,9 @@ function colorsOf(style) {
|
|
|
862
866
|
const page = solid(style.page);
|
|
863
867
|
const own = page && (keep ? aiHexOklch(page).L >= 0.85 && ratio(ink, page) >= 4.5 : aiHexOklch(page).L >= 0.9) ? page : null;
|
|
864
868
|
const background = own != null ? own : aiOklchHex(ground.L, ground.C * groundChroma, ground.h);
|
|
865
|
-
|
|
869
|
+
// Its bands' own fill is the paper they are drawn on (AGL-4152), where its words read on it.
|
|
870
|
+
const ownPaper = solid(style.paper);
|
|
871
|
+
const paper = ownPaper && keep && aiHexOklch(ownPaper).L >= 0.85 && ratio(ink, ownPaper) >= 4.5 ? ownPaper : aiOklchHex(ground.paper[0], ground.paper[1] * groundChroma, ground.h);
|
|
866
872
|
// The dark scheme's ground: its own, or a site brought in's (AGL-4152) where white and the
|
|
867
873
|
// scheme's words read on it and on its paper a step lighter.
|
|
868
874
|
const darkGround = style.ground === 'tinted' ? 0.024 : style.ground === 'warm' ? 0.014 : 0.012;
|
|
@@ -870,7 +876,9 @@ function colorsOf(style) {
|
|
|
870
876
|
const hex = solid(style.darkPage);
|
|
871
877
|
if (!hex) return null;
|
|
872
878
|
const at = aiHexOklch(hex);
|
|
873
|
-
|
|
879
|
+
// Its bands' own fill in its dark scheme, where its stylesheets say one and the words read on it; else a step lighter.
|
|
880
|
+
const read = solid(style.darkPaper);
|
|
881
|
+
const darkPaper = read && ratio(darkInk, read) >= 4.5 ? read : aiOklchHex(at.L + DARK_PAPER_STEP, at.C, at.h);
|
|
874
882
|
return ratio(white, hex) >= 4.5 && ratio(darkInk, hex) >= 4.5 && ratio(darkInk, darkPaper) >= 4.5 ? {
|
|
875
883
|
page: hex,
|
|
876
884
|
paper: darkPaper,
|
|
@@ -881,17 +889,20 @@ function colorsOf(style) {
|
|
|
881
889
|
const darkPaper = (_ref3 = darkOwn == null ? void 0 : darkOwn.paper) != null ? _ref3 : aiOklchHex(0.215, darkGround * groundChroma, style.ground === 'warm' ? 60 : h);
|
|
882
890
|
// Its cards and rules keep their place against its ground.
|
|
883
891
|
const darkShift = darkOwn ? darkOwn.L - 0.17 : 0;
|
|
884
|
-
// A site brought in's filled buttons (AGL-4152): their fill, and their words' nearest shade that reads on it
|
|
892
|
+
// A site brought in's filled buttons (AGL-4152): their fill, and their words' nearest shade that reads on it,
|
|
893
|
+
// or where no shade on their side does, the label that reads on the other: the fill is what a visitor knows.
|
|
885
894
|
const buttonFill = solid(style.buttonFill);
|
|
886
895
|
const buttonText = solid(style.buttonText);
|
|
887
|
-
const label = buttonFill && buttonText ? shadeOn(buttonText, buttonFill, 4.5) : null;
|
|
896
|
+
const label = buttonFill && buttonText ? (_shadeOn = shadeOn(buttonText, buttonFill, 4.5)) != null ? _shadeOn : crossedLabelOn(buttonFill) : null;
|
|
888
897
|
// The fill is the brand: drawn as the brand where its words read on it and it reads on the page.
|
|
889
898
|
const fillIsBrand = !!buttonFill && !!brand && buttonFill === solid(style.brand);
|
|
890
899
|
const ownPrimary = !!label && fillIsBrand && ratio(buttonFill, background) >= 3;
|
|
900
|
+
// The dark scheme's brand is words and links too, so it is the fill only where it reads at 4.5.
|
|
901
|
+
const fillReadsOnDark = fillIsBrand && ratio(buttonFill, darkBackground) >= 4.5;
|
|
891
902
|
// Else the filled buttons alone are drawn in it, where it is a fill of its own on the page: under
|
|
892
903
|
// white or black, on its words' own side, and on the dark ground at its nearest shade apart from it.
|
|
893
904
|
const ownLabel = buttonFill && label ? aiHexOklch(label).L >= aiHexOklch(buttonFill).L ? 'common.white' : 'common.black' : null;
|
|
894
|
-
const darkButtonFill = buttonFill && ownLabel && !ownPrimary && aiOklabDistance(buttonFill, background) >= OWN_FILL_APART ? apartFrom(buttonFill, darkBackground, COMMON[ownLabel]) : null;
|
|
905
|
+
const darkButtonFill = buttonFill && ownLabel && !(ownPrimary && fillReadsOnDark) && aiOklabDistance(buttonFill, background) >= OWN_FILL_APART ? apartFrom(buttonFill, darkBackground, COMMON[ownLabel]) : null;
|
|
895
906
|
const button = ownLabel && darkButtonFill ? {
|
|
896
907
|
label: ownLabel,
|
|
897
908
|
outlined: ratio(buttonFill, background) >= 3 && ratio(darkButtonFill, darkBackground) >= 3
|
|
@@ -987,7 +998,7 @@ function colorsOf(style) {
|
|
|
987
998
|
};
|
|
988
999
|
const darkChroma = Math.min(chroma, 0.14);
|
|
989
1000
|
// A site brought in's own button fill is the dark scheme's brand where it reads on its ground (AGL-4152).
|
|
990
|
-
const darkFill =
|
|
1001
|
+
const darkFill = fillReadsOnDark ? buttonFill : null;
|
|
991
1002
|
const darkPrimaryL = darkFill ? aiHexOklch(darkFill).L : untilContrast(0.78, darkChroma, h, darkBackground, 4.5, 1);
|
|
992
1003
|
const darkPrimary = darkFill != null ? darkFill : aiOklchHex(darkPrimaryL, darkChroma, h);
|
|
993
1004
|
const darkSecondary = neutral ? aiOklchHex(0.93, 0.01, h) : aiOklchHex(0.45, accentChroma * 0.85, buttonHue);
|
|
@@ -1190,6 +1201,55 @@ const rem = (value)=>`${Math.round(value * 1000) / 1000}rem`;
|
|
|
1190
1201
|
};
|
|
1191
1202
|
}
|
|
1192
1203
|
}
|
|
1204
|
+
/** The chroma under which a color is a grey or a black, no color of its own. */ const NEUTRAL_CHROMA = 0.03;
|
|
1205
|
+
/**
|
|
1206
|
+
* What Keep my site holds of its outlined and text buttons whatever the base
|
|
1207
|
+
* draws them in (AGL-4152): the primary's words and border with no fill of
|
|
1208
|
+
* their own, where the source's leave the ground showing, and each style's
|
|
1209
|
+
* own case where it differs from the filled buttons'.
|
|
1210
|
+
*/ function keptButtonVariants(style) {
|
|
1211
|
+
var _style_buttonCase;
|
|
1212
|
+
const filled = (_style_buttonCase = style.buttonCase) != null ? _style_buttonCase : style.buttons === 'caps' ? 'upper' : 'none';
|
|
1213
|
+
const caseOf = (own)=>own && own !== filled ? {
|
|
1214
|
+
textTransform: own === 'upper' ? 'uppercase' : 'none',
|
|
1215
|
+
letterSpacing: own === 'upper' ? '0.06em' : 'normal'
|
|
1216
|
+
} : {};
|
|
1217
|
+
// An outlined button the source draws in its words' own color, no color of its own: the theme's words, not the brand.
|
|
1218
|
+
const outline = solid(style.buttonOutline);
|
|
1219
|
+
const role = outline && aiHexOklch(outline).C < NEUTRAL_CHROMA ? 'text.primary' : 'primary.main';
|
|
1220
|
+
return [
|
|
1221
|
+
{
|
|
1222
|
+
props: {
|
|
1223
|
+
variant: 'outlined',
|
|
1224
|
+
color: 'primary'
|
|
1225
|
+
},
|
|
1226
|
+
sx: _extends({}, style.outlinedFill ? {} : {
|
|
1227
|
+
color: role,
|
|
1228
|
+
borderColor: role,
|
|
1229
|
+
bgcolor: 'transparent',
|
|
1230
|
+
'&:hover': {
|
|
1231
|
+
color: role,
|
|
1232
|
+
borderColor: role,
|
|
1233
|
+
bgcolor: 'action.hover'
|
|
1234
|
+
}
|
|
1235
|
+
}, caseOf(style.outlinedCase))
|
|
1236
|
+
},
|
|
1237
|
+
{
|
|
1238
|
+
props: {
|
|
1239
|
+
variant: 'text',
|
|
1240
|
+
color: 'primary'
|
|
1241
|
+
},
|
|
1242
|
+
sx: _extends({
|
|
1243
|
+
color: 'primary.main',
|
|
1244
|
+
bgcolor: 'transparent',
|
|
1245
|
+
'&:hover': {
|
|
1246
|
+
color: 'primary.main',
|
|
1247
|
+
bgcolor: 'action.hover'
|
|
1248
|
+
}
|
|
1249
|
+
}, caseOf(style.textCase))
|
|
1250
|
+
}
|
|
1251
|
+
];
|
|
1252
|
+
}
|
|
1193
1253
|
/**
|
|
1194
1254
|
* The button styles that draw a site brought in's filled buttons in its own
|
|
1195
1255
|
* fill (AGL-4152), in palette roles: the fill is the primary's lighter shade
|
|
@@ -1442,7 +1502,7 @@ function isRecord(value) {
|
|
|
1442
1502
|
borderRadius: RADIUS[style.corners]
|
|
1443
1503
|
}),
|
|
1444
1504
|
spacing: SPACING[style.density],
|
|
1445
|
-
components:
|
|
1505
|
+
components: withKeptButtons(components, style, colors.button)
|
|
1446
1506
|
});
|
|
1447
1507
|
delete theme.darkScheme;
|
|
1448
1508
|
// A site brought in is set in its source's own families (AGL-4108), at the
|
|
@@ -1502,23 +1562,25 @@ function isRecord(value) {
|
|
|
1502
1562
|
// and the buttons drawn in them rather than in a fill the starter's colors know nothing of.
|
|
1503
1563
|
theme = _extends({}, theme, {
|
|
1504
1564
|
colorSchemes: DEFAULT_SITE_THEME.colorSchemes,
|
|
1505
|
-
components
|
|
1565
|
+
components: withKeptButtons(components, style, null)
|
|
1506
1566
|
});
|
|
1507
1567
|
}
|
|
1508
1568
|
return theme;
|
|
1509
1569
|
}
|
|
1510
1570
|
/**
|
|
1511
|
-
* The components with
|
|
1512
|
-
*
|
|
1513
|
-
*
|
|
1514
|
-
*/ function
|
|
1571
|
+
* The components with a kept site's buttons (AGL-4152): after the button
|
|
1572
|
+
* styles the theme already holds, the base's or the look's, so these win where
|
|
1573
|
+
* both style one; last, the filled buttons in the source's own fill.
|
|
1574
|
+
*/ function withKeptButtons(components, style, button) {
|
|
1515
1575
|
var _components_MuiButton, _own_variants;
|
|
1576
|
+
if (style.finish !== 'keep') return components;
|
|
1516
1577
|
const own = (_components_MuiButton = components['MuiButton']) != null ? _components_MuiButton : {};
|
|
1517
1578
|
return _extends({}, components, {
|
|
1518
1579
|
MuiButton: _extends({}, own, {
|
|
1519
1580
|
variants: [
|
|
1520
1581
|
...(_own_variants = own.variants) != null ? _own_variants : [],
|
|
1521
|
-
...
|
|
1582
|
+
...keptButtonVariants(style),
|
|
1583
|
+
...button ? ownButtonVariants(button) : []
|
|
1522
1584
|
]
|
|
1523
1585
|
})
|
|
1524
1586
|
});
|