@estiva-app/ui 0.74.1 → 0.75.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.
Files changed (67) hide show
  1. package/dist/CardUnder.d.ts +10 -0
  2. package/dist/CardUnder.d.ts.map +1 -0
  3. package/dist/InlineChip.d.ts +2 -0
  4. package/dist/InlineChip.d.ts.map +1 -1
  5. package/dist/LinkCard.d.ts +17 -0
  6. package/dist/LinkCard.d.ts.map +1 -0
  7. package/dist/LinkChip.d.ts +8 -0
  8. package/dist/LinkChip.d.ts.map +1 -0
  9. package/dist/LinkParts.d.ts +45 -0
  10. package/dist/LinkParts.d.ts.map +1 -0
  11. package/dist/LinkPreview.d.ts +21 -0
  12. package/dist/LinkPreview.d.ts.map +1 -0
  13. package/dist/LinkRow.d.ts +24 -0
  14. package/dist/LinkRow.d.ts.map +1 -0
  15. package/dist/PartCard.d.ts +32 -0
  16. package/dist/PartCard.d.ts.map +1 -0
  17. package/dist/Skeleton.d.ts +12 -2
  18. package/dist/Skeleton.d.ts.map +1 -1
  19. package/dist/eslint/index.js +1 -0
  20. package/dist/eslint/index.js.map +2 -2
  21. package/dist/eslint/no-restyled-part.d.ts.map +1 -1
  22. package/dist/index.d.ts +8 -0
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +480 -71
  25. package/dist/index.js.map +4 -4
  26. package/dist/linked.d.ts +168 -0
  27. package/dist/linked.d.ts.map +1 -0
  28. package/dist/linked.examples.d.ts +27 -0
  29. package/dist/linked.examples.d.ts.map +1 -0
  30. package/package.json +1 -1
  31. package/registry.json +784 -7
  32. package/src/CardUnder.mdx +53 -0
  33. package/src/CardUnder.stories.tsx +45 -0
  34. package/src/CardUnder.test.tsx +40 -0
  35. package/src/CardUnder.tsx +45 -0
  36. package/src/InlineChip.tsx +2 -0
  37. package/src/LinkCard.mdx +58 -0
  38. package/src/LinkCard.stories.tsx +68 -0
  39. package/src/LinkCard.test.tsx +103 -0
  40. package/src/LinkCard.tsx +209 -0
  41. package/src/LinkChip.mdx +51 -0
  42. package/src/LinkChip.stories.tsx +40 -0
  43. package/src/LinkChip.test.tsx +83 -0
  44. package/src/LinkChip.tsx +51 -0
  45. package/src/LinkParts.mdx +49 -0
  46. package/src/LinkParts.stories.tsx +61 -0
  47. package/src/LinkParts.tsx +147 -0
  48. package/src/LinkPreview.mdx +47 -0
  49. package/src/LinkPreview.stories.tsx +38 -0
  50. package/src/LinkPreview.tsx +55 -0
  51. package/src/LinkRow.mdx +47 -0
  52. package/src/LinkRow.stories.tsx +49 -0
  53. package/src/LinkRow.test.tsx +38 -0
  54. package/src/LinkRow.tsx +107 -0
  55. package/src/PartCard.mdx +43 -0
  56. package/src/PartCard.stories.tsx +35 -0
  57. package/src/PartCard.test.tsx +30 -0
  58. package/src/PartCard.tsx +59 -0
  59. package/src/Skeleton.tsx +7 -3
  60. package/src/eslint/no-native-title.test.ts +3 -2
  61. package/src/eslint/no-restyled-part.ts +1 -0
  62. package/src/index.ts +25 -0
  63. package/src/linked.examples.ts +107 -0
  64. package/src/linked.test.ts +58 -0
  65. package/src/linked.ts +217 -0
  66. package/src/registry/registry.test.ts +8 -8
  67. package/stories/Choosing.mdx +7 -0
@@ -0,0 +1,168 @@
1
+ /**
2
+ * What a link stands for, as the link widgets draw it (LinkChip, LinkRow,
3
+ * LinkCard, LinkPreview, CardUnder). The app builds it from its own lookup —
4
+ * every Estiva app from `@estiva-app/interop`'s projection — and hands it in
5
+ * whole: the words, the addresses, and the changes the reader may make. The
6
+ * widgets look nothing up, and keep nothing but what a reader does to them.
7
+ *
8
+ * The shape follows the prototype Miky approved (Widgets 2, 15 Oct; why:
9
+ * https://github.com/estiva-app/estiva-docs/blob/main/decisions/where-a-link-sits-and-which-file-gets-the-card.md).
10
+ */
11
+ import type { ThingKind } from './KindIcon';
12
+ /** What a link stands for, by its icon. `page` draws a page of text. */
13
+ export type LinkedKind = ThingKind | 'page';
14
+ /** The colours a status draws in, as an app's manifest names them. */
15
+ export type StatusColour = 'neutral' | 'blue' | 'green' | 'muted';
16
+ /** One value of a status, as the reader sees it. */
17
+ export interface LinkedStatus {
18
+ label: string;
19
+ colour: StatusColour;
20
+ }
21
+ /** A person, by the name the app shows and, when it has one, their picture. */
22
+ export interface LinkedPerson {
23
+ name: string;
24
+ picture?: string;
25
+ }
26
+ /** One choice a picker offers. */
27
+ export interface PickerOption {
28
+ value: string;
29
+ label: string;
30
+ /** A status's colour: the option draws its shape. */
31
+ colour?: StatusColour;
32
+ /** A person's picture: the option draws their face. */
33
+ picture?: string;
34
+ }
35
+ /**
36
+ * A value the reader may be able to change from the card: a status, or who
37
+ * owns it. With `onChange` it is a picker; without it, the reader may not
38
+ * change it, and it reads as words in the same place.
39
+ */
40
+ export interface LinkedPicker {
41
+ /** The chosen option's `value`; `undefined` is nobody, for an owner. */
42
+ value: string | undefined;
43
+ options: PickerOption[];
44
+ onChange?: (value: string) => void;
45
+ }
46
+ /** The count of what was said about it, and where that is read. */
47
+ export interface LinkedConversation {
48
+ count: number;
49
+ /** Opens the conversation, at the first unread when there is one. */
50
+ href: string;
51
+ /**
52
+ * The reader has something unread there. Only a member of it has unread
53
+ * (SPEC §11.8; why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/membership-replaces-following.md),
54
+ * so the app passes `true` only for one.
55
+ */
56
+ unread?: boolean;
57
+ }
58
+ /** One item listed inside a card, such as a group's members, each opening on its own. */
59
+ export interface LinkedChild {
60
+ id: string;
61
+ title: string;
62
+ href: string;
63
+ key?: string;
64
+ status: LinkedStatus;
65
+ owner?: LinkedPerson;
66
+ }
67
+ /** Everything a link's widgets may draw about what it stands for. Only `id`, `kind`, `title` and `href` are always there. */
68
+ export interface Linked {
69
+ /** Its address. Two `Linked` with the same `id` are the same thing (identity by value, not by object). */
70
+ id: string;
71
+ kind: LinkedKind;
72
+ title: string;
73
+ /** Opens it. An address in this app goes through `AppProvider`'s `navigate`. */
74
+ href: string;
75
+ /** What the reader calls it, quietly before the title: "ABC-2". */
76
+ key?: string;
77
+ /** The line under a card's title: what it is in. Drawn after the key. */
78
+ subtitle?: string;
79
+ /** Its short summary, a sentence or two. Without one a card shows the title alone. */
80
+ summary?: string;
81
+ /** Its status: each option carries its `colour`. */
82
+ status?: LinkedPicker;
83
+ /** Who owns it, by the word the app uses (`ownerLabel`: "Assignee", "Lead"). */
84
+ owner?: LinkedPicker;
85
+ ownerLabel?: string;
86
+ /** What was said about it. `noun` names it for a screen reader: "comments" by default. */
87
+ conversation?: LinkedConversation & {
88
+ noun?: string;
89
+ };
90
+ /** Items inside it, drawn as rows in its card. */
91
+ children?: LinkedChild[];
92
+ /** How far along it is, drawn as a ring. */
93
+ done?: {
94
+ done: number;
95
+ total: number;
96
+ };
97
+ /** Who is in it, as faces. */
98
+ members?: LinkedPerson[];
99
+ /** Who wrote it, as faces. */
100
+ authors?: LinkedPerson[];
101
+ /** When it last changed, in the app's words: "2h ago". */
102
+ updated?: string;
103
+ /** The newest thing said in it, drawn only when the reader may read it. */
104
+ latest?: {
105
+ author: LinkedPerson;
106
+ body: string;
107
+ at: string;
108
+ };
109
+ /** Words a person wrote, linked as themselves: drawn with `author`'s face, not an icon. */
110
+ body?: string;
111
+ author?: LinkedPerson;
112
+ }
113
+ /** What a card's last line holds: pickers, faces, a line of words, or nothing. */
114
+ export type LoadingFooter = 'pickers' | 'people' | 'line' | 'none';
115
+ /** The parts of a card known before it loads, so its placeholder takes the card's height. */
116
+ export interface LoadingShape {
117
+ subtitle?: boolean;
118
+ summary?: boolean;
119
+ rows?: number;
120
+ latest?: boolean;
121
+ ring?: boolean;
122
+ footer?: LoadingFooter;
123
+ }
124
+ /**
125
+ * Where a link's lookup stands. `loading` knows the kind from the address, and
126
+ * a shape when the app remembers one; `unavailable` is deleted or not the
127
+ * reader's to see, which read the same (Miky, 15 Oct).
128
+ */
129
+ export type LinkState = {
130
+ state: 'loading';
131
+ kind: LinkedKind;
132
+ shape?: LoadingShape;
133
+ } | {
134
+ state: 'unavailable';
135
+ kind: LinkedKind;
136
+ /** What it is, in a word: "Item". */
137
+ noun: string;
138
+ /** Where it may still open for someone who can: the app that owns it, and its address. */
139
+ openIn?: {
140
+ app: string;
141
+ href: string;
142
+ };
143
+ } | {
144
+ state: 'ready';
145
+ linked: Linked;
146
+ };
147
+ /** A picker's chosen option, or none. */
148
+ export declare function chosenOf(picker: LinkedPicker | undefined): PickerOption | undefined;
149
+ /** The shape `linked`'s card takes, for its placeholder the next time it loads. */
150
+ export declare function loadingShapeOf(linked: Linked): LoadingShape;
151
+ /**
152
+ * What this device last found it could not show, kept so the next open draws
153
+ * "not available." from the first paint instead of a card's height that then
154
+ * closes (Peek's OPT-10; Miky, 15 Oct). One per app, under its own key, in
155
+ * localStorage because the first paint reads it synchronously. The app clears
156
+ * it with the rest of the device's copy at sign-out.
157
+ */
158
+ export interface UnavailableMemory {
159
+ /** Whether this device last found `id` not available. */
160
+ has: (id: string) => boolean;
161
+ /** The lookup's answer: remembered when not available, forgotten when it is. */
162
+ note: (id: string, available: boolean) => void;
163
+ /** Sign-out. */
164
+ clear: () => void;
165
+ }
166
+ /** The device's memory of links it could not show, under the app's own `storageKey`, keeping the newest `limit`. */
167
+ export declare function unavailableMemory(storageKey: string, limit?: number): UnavailableMemory;
168
+ //# sourceMappingURL=linked.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linked.d.ts","sourceRoot":"","sources":["../src/linked.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,wEAAwE;AACxE,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,MAAM,CAAA;AAE3C,sEAAsE;AACtE,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAA;AAEjE,oDAAoD;AACpD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,YAAY,CAAA;C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M,SAAS,GACjB;IAAE,KAAK,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,CAAC,EAAE,YAAY,CAAA;CAAE,GAC5D;IACE,KAAK,EAAE,aAAa,CAAA;IACpB,IAAI,EAAE,UAAU,CAAA;IAChB,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAA;IACZ,0FAA0F;IAC1F,MAAM,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CACvC,GACD;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAEtC,yCAAyC;AACzC,wBAAgB,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,CAEnF;AAED,mFAAmF;AACnF,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAS3D;AAED;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,yDAAyD;IACzD,GAAG,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAA;IAC5B,gFAAgF;IAChF,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,CAAA;IAC9C,gBAAgB;IAChB,KAAK,EAAE,MAAM,IAAI,CAAA;CAClB;AAED,oHAAoH;AACpH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,SAAM,GAAG,iBAAiB,CAuCpF"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Placeholder links for the link widgets' stories and tests: neutral words,
3
+ * every field one of the widgets draws. Not exported from the package.
4
+ */
5
+ import type { Linked, LinkState, PickerOption } from './linked';
6
+ export declare const STATUS_OPTIONS: PickerOption[];
7
+ export declare const PEOPLE: PickerOption[];
8
+ /** A tracked item: a key, a status and an owner the reader may change, and a conversation. */
9
+ export declare const ITEM: Linked;
10
+ /** The same item, to a reader who may not change it. */
11
+ export declare const ITEM_READ_ONLY: Linked;
12
+ /** The same item with something unread in its conversation, as a member sees it. */
13
+ export declare const ITEM_UNREAD: Linked;
14
+ /** An item with no summary: its card shows the title alone. */
15
+ export declare const ITEM_NO_SUMMARY: Linked;
16
+ /** A group of items: its progress, its owner, and the items inside it. */
17
+ export declare const GROUP: Linked;
18
+ /** A place people talk: its members, when it last moved, and its newest conversation. */
19
+ export declare const PLACE: Linked;
20
+ /** A page of text: who wrote it, and when it last changed. */
21
+ export declare const PAGE: Linked;
22
+ /** Words a person wrote, linked as themselves. */
23
+ export declare const SAID: Linked;
24
+ export declare const ready: (linked: Linked) => LinkState;
25
+ export declare const LOADING: LinkState;
26
+ export declare const UNAVAILABLE: LinkState;
27
+ //# sourceMappingURL=linked.examples.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linked.examples.d.ts","sourceRoot":"","sources":["../src/linked.examples.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,MAAM,EAAgB,SAAS,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAI7E,eAAO,MAAM,cAAc,EAAE,YAAY,EAKxC,CAAA;AAED,eAAO,MAAM,MAAM,EAAE,YAAY,EAIhC,CAAA;AAMD,8FAA8F;AAC9F,eAAO,MAAM,IAAI,EAAE,MAYlB,CAAA;AAED,wDAAwD;AACxD,eAAO,MAAM,cAAc,EAAE,MAAuG,CAAA;AAEpI,oFAAoF;AACpF,eAAO,MAAM,WAAW,EAAE,MAA0F,CAAA;AAEpH,+DAA+D;AAC/D,eAAO,MAAM,eAAe,EAAE,MAAiI,CAAA;AAE/J,0EAA0E;AAC1E,eAAO,MAAM,KAAK,EAAE,MAgBnB,CAAA;AAED,yFAAyF;AACzF,eAAO,MAAM,KAAK,EAAE,MAUnB,CAAA;AAED,8DAA8D;AAC9D,eAAO,MAAM,IAAI,EAAE,MASlB,CAAA;AAED,kDAAkD;AAClD,eAAO,MAAM,IAAI,EAAE,MAQlB,CAAA;AAED,eAAO,MAAM,KAAK,GAAI,QAAQ,MAAM,KAAG,SAAyC,CAAA;AAChF,eAAO,MAAM,OAAO,EAAE,SAA+C,CAAA;AACrE,eAAO,MAAM,WAAW,EAAE,SAAiH,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@estiva-app/ui",
3
- "version": "0.74.1",
3
+ "version": "0.75.0",
4
4
  "description": "Estiva's design tokens (the contract) and a small set of primitives (a convenience) for every Estiva app.",
5
5
  "type": "module",
6
6
  "license": "MIT",