@estiva-app/ui 0.19.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AttachmentCard.d.ts.map +1 -1
- package/dist/Breadcrumb.d.ts.map +1 -1
- package/dist/Button.d.ts +6 -1
- package/dist/Button.d.ts.map +1 -1
- package/dist/Card.d.ts +6 -1
- package/dist/Card.d.ts.map +1 -1
- package/dist/DialogShell.d.ts.map +1 -1
- package/dist/Divider.d.ts +7 -0
- package/dist/Divider.d.ts.map +1 -1
- package/dist/IconButton.d.ts +12 -2
- package/dist/IconButton.d.ts.map +1 -1
- package/dist/IdentityMenu.d.ts.map +1 -1
- package/dist/Link.d.ts +6 -1
- package/dist/Link.d.ts.map +1 -1
- package/dist/Menu.d.ts.map +1 -1
- package/dist/Popover.d.ts.map +1 -1
- package/dist/ReactionPicker.d.ts.map +1 -1
- package/dist/SectionLabel.d.ts +6 -1
- package/dist/SectionLabel.d.ts.map +1 -1
- package/dist/Tooltip.d.ts.map +1 -1
- package/dist/eslint/index.d.ts +2 -0
- package/dist/eslint/index.d.ts.map +1 -1
- package/dist/eslint/index.js +514 -6
- package/dist/eslint/index.js.map +4 -4
- package/dist/eslint/no-restyled-part.d.ts +81 -0
- package/dist/eslint/no-restyled-part.d.ts.map +1 -0
- package/dist/index.js +290 -266
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
- package/src/AttachmentCard.tsx +7 -2
- package/src/Banner.tsx +2 -2
- package/src/Breadcrumb.tsx +9 -4
- package/src/Button.mdx +7 -0
- package/src/Button.stories.tsx +4 -1
- package/src/Button.tsx +10 -2
- package/src/Card.mdx +7 -0
- package/src/Card.stories.tsx +11 -0
- package/src/Card.tsx +8 -0
- package/src/CommandPalette.tsx +1 -1
- package/src/ConfirmDialog.tsx +2 -2
- package/src/DialogShell.tsx +6 -7
- package/src/Divider.mdx +3 -0
- package/src/Divider.tsx +12 -2
- package/src/EditableText.mdx +5 -0
- package/src/IconButton.mdx +9 -0
- package/src/IconButton.stories.tsx +10 -1
- package/src/IconButton.tsx +22 -3
- package/src/IdentityMenu.tsx +4 -1
- package/src/Link.mdx +6 -0
- package/src/Link.stories.tsx +12 -0
- package/src/Link.tsx +7 -2
- package/src/Menu.stories.tsx +1 -1
- package/src/Menu.test.tsx +2 -2
- package/src/Menu.tsx +6 -3
- package/src/Person.stories.tsx +5 -5
- package/src/Popover.test.tsx +2 -2
- package/src/Popover.tsx +3 -2
- package/src/PreviewCard.tsx +1 -1
- package/src/Property.stories.tsx +2 -2
- package/src/ReactionPicker.tsx +6 -3
- package/src/ScrollArea.stories.tsx +21 -7
- package/src/SectionLabel.mdx +3 -2
- package/src/SectionLabel.stories.tsx +3 -0
- package/src/SectionLabel.tsx +7 -2
- package/src/Tooltip.tsx +12 -14
- package/src/eslint/index.test.ts +32 -7
- package/src/eslint/index.ts +10 -1
- package/src/eslint/no-restyled-part.test.ts +301 -0
- package/src/eslint/no-restyled-part.ts +647 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { Rule, Scope } from 'eslint';
|
|
2
|
+
/**
|
|
3
|
+
* A part of the package is placed from outside, never restyled (UIG-9; Katerina's
|
|
4
|
+
* ruling B8 of 13 September, "only position and spacing pass into our
|
|
5
|
+
* components").
|
|
6
|
+
*
|
|
7
|
+
* Every part takes `className`, and some take a second class prop for an inner
|
|
8
|
+
* box (`contentClassName`, `bodyClassName`…). Through either, an app could push
|
|
9
|
+
* a colour, a text size or a border into a part and quietly undo it: the token
|
|
10
|
+
* lint only asks whether a class is a real token, never whether the part should
|
|
11
|
+
* take it. This rule reads every class passed into a part and lets through only
|
|
12
|
+
* placement — where the part sits and how much room it takes.
|
|
13
|
+
*
|
|
14
|
+
* **Which elements are parts: by where they come from, never by name.** No list
|
|
15
|
+
* of names is kept, so a part added to the package later is covered the day it
|
|
16
|
+
* is added.
|
|
17
|
+
*
|
|
18
|
+
* - In an app: anything imported from `@estiva-app/ui`, and anything imported
|
|
19
|
+
* from the app's own files that is one of those — a re-export (Peek's
|
|
20
|
+
* `components/ui/Button.tsx`), a wrapper that hands its props on to a part
|
|
21
|
+
* (`{...rest}`), or a component that hands its own `className` on to a part
|
|
22
|
+
* (Peek's `ConversationCard` into `Card`). Relative imports and the apps' `@/`
|
|
23
|
+
* alias are followed; `@/` is the `src` folder beside the nearest
|
|
24
|
+
* `package.json`.
|
|
25
|
+
* - Inside the package (Katerina, 17 September): a name `src/index.ts` exports,
|
|
26
|
+
* imported from a sibling file or declared in the same file.
|
|
27
|
+
*
|
|
28
|
+
* **What it reads:** a string, a template, `cn()`/`clsx()` and their arguments,
|
|
29
|
+
* both sides of a condition, a `const` in the same file and the values of a
|
|
30
|
+
* class map read from one. A class the code works out while it runs passes: the
|
|
31
|
+
* rule cannot read it.
|
|
32
|
+
*
|
|
33
|
+
* `EmptyState` takes no padding either (Katerina's ruling 6 of 14 September):
|
|
34
|
+
* its room comes from the box its rows live in.
|
|
35
|
+
*/
|
|
36
|
+
/** Where a part sits and how much room it takes. Read on the utility, after its variants. */
|
|
37
|
+
export declare const PLACEMENT: {
|
|
38
|
+
what: string;
|
|
39
|
+
pattern: RegExp;
|
|
40
|
+
}[];
|
|
41
|
+
/** A class list's variants and its utility: `sm:[&>*]:shrink-0` → `['sm', '[&>*]']`, `shrink-0`. */
|
|
42
|
+
export declare function splitClass(token: string): {
|
|
43
|
+
variants: string[];
|
|
44
|
+
utility: string;
|
|
45
|
+
};
|
|
46
|
+
/** Whether a class only places the part. */
|
|
47
|
+
export declare function isPlacement(token: string): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* The props a part has for how it looks, named in the message. Held to the
|
|
50
|
+
* package's source by `no-restyled-part.test.ts`: every prop here exists, and
|
|
51
|
+
* every look prop an exported part has is here. A part missing from this table
|
|
52
|
+
* has none, and the message says to ask for one.
|
|
53
|
+
*/
|
|
54
|
+
export declare const PART_LOOK_PROPS: Record<string, string[]>;
|
|
55
|
+
interface Node {
|
|
56
|
+
type: string;
|
|
57
|
+
range: [number, number];
|
|
58
|
+
loc?: NonNullable<Rule.Node['loc']>;
|
|
59
|
+
parent?: Node;
|
|
60
|
+
[key: string]: unknown;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* What a name is to this rule: the part it draws, and which of the caller's
|
|
64
|
+
* class props reach which of the part's (`all` for a part, a re-export or a
|
|
65
|
+
* wrapper; a map for a component that hands on its own `className`). `via` is
|
|
66
|
+
* the app's own component in between, for the message.
|
|
67
|
+
*/
|
|
68
|
+
export interface PartBinding {
|
|
69
|
+
part: string;
|
|
70
|
+
props: 'all' | Record<string, string>;
|
|
71
|
+
via?: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Every class the code spells out for a value, as far as it can be read in this
|
|
75
|
+
* file. `asMap` reads an object as a class map (its values) rather than as a
|
|
76
|
+
* `clsx` object (its keys).
|
|
77
|
+
*/
|
|
78
|
+
export declare function classesOf(value: Node | null | undefined, scopeOf: (node: Node) => Scope.Scope | null, asMap?: boolean, seen?: Set<Node>): string[];
|
|
79
|
+
export declare const noRestyledPart: Rule.RuleModule;
|
|
80
|
+
export {};
|
|
81
|
+
//# sourceMappingURL=no-restyled-part.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-restyled-part.d.ts","sourceRoot":"","sources":["../../src/eslint/no-restyled-part.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAGzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAIH,6FAA6F;AAC7F,eAAO,MAAM,SAAS,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EAUxD,CAAA;AASD,oGAAoG;AACpG,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,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