@estiva-app/ui 0.43.0 → 0.44.1
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/eslint/index.js +21 -0
- package/dist/eslint/index.js.map +2 -2
- package/dist/eslint/no-handmade-empty-state.d.ts +7 -0
- package/dist/eslint/no-handmade-empty-state.d.ts.map +1 -1
- package/dist/gates/app-checks.d.ts.map +1 -1
- package/dist/gates/{chunk-SYVKGOWM.js → chunk-P5W6O5TF.js} +114 -63
- package/dist/gates/chunk-P5W6O5TF.js.map +7 -0
- package/dist/gates/cli.js +1 -1
- package/dist/gates/gate-config.d.ts.map +1 -1
- package/dist/gates/index.js +16 -4
- package/dist/gates/index.js.map +2 -2
- package/dist/gates/token-joined.d.ts +28 -0
- package/dist/gates/token-joined.d.ts.map +1 -0
- package/dist/gates/token-lint.d.ts.map +1 -1
- package/package.json +1 -1
- package/registry.json +1 -1
- package/src/EmptyState.mdx +1 -1
- package/src/eslint/no-handmade-empty-state.test.ts +23 -1
- package/src/eslint/no-handmade-empty-state.ts +37 -1
- package/src/gates/app-checks.ts +13 -1
- package/src/gates/create-app.test.ts +1 -2
- package/src/gates/gate-config.ts +2 -0
- package/src/gates/gates.test.ts +26 -0
- package/src/gates/token-joined.ts +94 -0
- package/src/gates/token-lint.ts +68 -66
- package/dist/gates/chunk-SYVKGOWM.js.map +0 -7
package/dist/eslint/index.js
CHANGED
|
@@ -817,6 +817,12 @@ function standsInForAList(element) {
|
|
|
817
817
|
return false;
|
|
818
818
|
}
|
|
819
819
|
var FILLS = /^(?:min-h-full|h-full)$/;
|
|
820
|
+
var CENTRES = /^(?:justify-center|items-center|content-center|place-(?:items|content)-center)$/;
|
|
821
|
+
var PADS = /^p[xytrblse]?-/;
|
|
822
|
+
function onlyElement(box) {
|
|
823
|
+
const kids = children2(box, "children").filter((kid) => !(kid.type === "JSXText" && !String(kid.value).trim()));
|
|
824
|
+
return kids.length === 1 && kids[0].type === "JSXElement" ? kids[0] : void 0;
|
|
825
|
+
}
|
|
820
826
|
function isPageScope(opening) {
|
|
821
827
|
const scope = attributeOf(opening, "scope");
|
|
822
828
|
if (!scope) return true;
|
|
@@ -882,6 +888,7 @@ var noHandmadeEmptyState = {
|
|
|
882
888
|
messages: {
|
|
883
889
|
handmade: 'A line saying there is nothing is an EmptyState. Use `EmptyState` from @estiva-app/ui: `scope="section"` inside a section, `scope="page"` for a whole page.',
|
|
884
890
|
wrongScope: 'A page-scope EmptyState inside a ScrollArea sits at the top of its pane, not the middle: the ScrollArea\'s content is only as tall as what is in it. Use `scope="section"` when the pane has anything else on it; when the whole pane is empty, draw the page EmptyState in place of the ScrollArea, not inside it.',
|
|
891
|
+
boxedPage: 'This box {{what}} a page-scope EmptyState, which centres itself in the room a flex column gives it and takes no padding. A box that places it can push it out of the middle, as the starter\'s home page did (UIG-10). Draw the EmptyState straight into the column, with `className="h-full"` outside a flex column.',
|
|
885
892
|
wrongScopeVia: '`{{component}}` draws a page-scope EmptyState ({{where}}) inside this ScrollArea, where it sits at the top of its pane, not the middle: the ScrollArea\'s content is only as tall as what is in it. Use `scope="section"` there when the pane has anything else on it; when the whole pane is empty, draw the page EmptyState in place of the ScrollArea, not inside it.',
|
|
886
893
|
...ESCAPE_MESSAGES
|
|
887
894
|
}
|
|
@@ -901,6 +908,20 @@ var noHandmadeEmptyState = {
|
|
|
901
908
|
const opening = child2(element, "openingElement");
|
|
902
909
|
const tag = tagName(element);
|
|
903
910
|
if (tag && /^[a-z]/.test(tag)) {
|
|
911
|
+
const only = facts && onlyElement(element);
|
|
912
|
+
const inner = only && child2(only, "openingElement");
|
|
913
|
+
const spread = inner && children2(inner, "attributes").some((a) => a.type === "JSXSpreadAttribute");
|
|
914
|
+
if (inner && !spread && isPart(bindingOfTag(child2(inner, "name"), facts.locals), "EmptyState") && isPageScope(inner)) {
|
|
915
|
+
const className = attributeOf(opening, "className");
|
|
916
|
+
const own = className ? classesOf(child2(className, "value"), scopeOf).map((c) => c.replace(/^(?:[^:\s[\]]+:)+/, "")) : [];
|
|
917
|
+
const centres = own.some((c) => CENTRES.test(c));
|
|
918
|
+
const pads = own.some((c) => PADS.test(c));
|
|
919
|
+
if ((centres || pads) && !isEscaped(context, opening)) {
|
|
920
|
+
const what = centres && pads ? "centres and pads" : centres ? "centres" : "pads";
|
|
921
|
+
context.report({ loc: opening.loc, messageId: "boxedPage", data: { what } });
|
|
922
|
+
}
|
|
923
|
+
return;
|
|
924
|
+
}
|
|
904
925
|
const words2 = onlyWords(element);
|
|
905
926
|
if (!words2 || words2.length > SHORT) return;
|
|
906
927
|
if (!standsInForAList(element)) return;
|