@estiva-app/ui 0.102.0 → 0.102.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/dist/LinkRow.d.ts +8 -2
- package/dist/LinkRow.d.ts.map +1 -1
- package/dist/index.js +12 -7
- package/dist/index.js.map +3 -3
- package/dist/linked.d.ts +4 -0
- package/dist/linked.d.ts.map +1 -1
- package/dist/linkedFrom.d.ts +1 -0
- package/dist/linkedFrom.d.ts.map +1 -1
- package/package.json +1 -1
- package/registry.json +13 -1
- package/src/LinkCard.stories.tsx +6 -0
- package/src/LinkCard.tsx +1 -1
- package/src/LinkRow.test.tsx +13 -0
- package/src/LinkRow.tsx +13 -6
- package/src/linked.ts +4 -0
- package/src/linkedFrom.test.tsx +18 -1
- package/src/linkedFrom.ts +8 -3
package/dist/LinkRow.d.ts
CHANGED
|
@@ -3,6 +3,10 @@ export interface LinkUnavailableProps {
|
|
|
3
3
|
kind: LinkedKind;
|
|
4
4
|
/** What it is, in a word: "Issue". Drawn as "You can't open this issue", or "Issue deleted". */
|
|
5
5
|
noun: string;
|
|
6
|
+
/** `noun` is its app's name ("App one"), its type having none: "You can't open this file in App one". */
|
|
7
|
+
named?: boolean;
|
|
8
|
+
/** Its read failed (the network, a busy relay), which says nothing about access: "Couldn't load this issue". */
|
|
9
|
+
failed?: boolean;
|
|
6
10
|
/** @deprecated Not drawn since 0.102.0: someone who can't open it has nowhere to go. */
|
|
7
11
|
openIn?: {
|
|
8
12
|
app: string;
|
|
@@ -19,9 +23,11 @@ export interface LinkUnavailableProps {
|
|
|
19
23
|
* would have been, on the same fill and edge (Katerina, 29 Oct: "same styling
|
|
20
24
|
* as the linkcard default"), its words muted. Not this reader's: "You can't
|
|
21
25
|
* open this issue", the approved story's words, with no way out, since there
|
|
22
|
-
* is nothing for them to open (Miky, ALO-4's review, 3 November).
|
|
26
|
+
* is nothing for them to open (Miky, ALO-4's review, 3 November). A read that
|
|
27
|
+
* failed says "Couldn't load this issue" instead: it is not an answer about
|
|
28
|
+
* access (Miky, 3 November).
|
|
23
29
|
*/
|
|
24
|
-
export declare function LinkUnavailable({ kind, noun, card, deleted }: LinkUnavailableProps): import("react").JSX.Element;
|
|
30
|
+
export declare function LinkUnavailable({ kind, noun, named, card, deleted, failed }: LinkUnavailableProps): import("react").JSX.Element;
|
|
25
31
|
/** The not-available row with the words it is given; `href` makes the words a link (a part that can't be shown opens its whole file). */
|
|
26
32
|
export declare function UnavailableRow({ kind, words, href, card }: {
|
|
27
33
|
kind: LinkedKind;
|
package/dist/LinkRow.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkRow.d.ts","sourceRoot":"","sources":["../src/LinkRow.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAsB,KAAK,MAAM,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAA;AAM3F,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,UAAU,CAAA;IAChB,gGAAgG;IAChG,IAAI,EAAE,MAAM,CAAA;IACZ,wFAAwF;IACxF,MAAM,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;IACtC,kEAAkE;IAClE,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,oGAAoG;IACpG,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAKD
|
|
1
|
+
{"version":3,"file":"LinkRow.d.ts","sourceRoot":"","sources":["../src/LinkRow.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAsB,KAAK,MAAM,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAA;AAM3F,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,UAAU,CAAA;IAChB,gGAAgG;IAChG,IAAI,EAAE,MAAM,CAAA;IACZ,yGAAyG;IACzG,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,gHAAgH;IAChH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,wFAAwF;IACxF,MAAM,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;IACtC,kEAAkE;IAClE,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,oGAAoG;IACpG,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAKD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAa,EAAE,IAAY,EAAE,OAAe,EAAE,MAAc,EAAE,EAAE,oBAAoB,+BAKjI;AAED,yIAAyI;AACzI,wBAAgB,cAAc,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAY,EAAE,EAAE;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,+BAkBrI;AAED,sJAAsJ;AACtJ,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,UAAQ,GAAG,MAAM,CAEnE;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EAAE,GAAG,EAAE,KAAa,EAAE,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,+BAOlF;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,SAAS,CAAA;IACf,+BAA+B;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,OAAO,CAAC,EAAE,IAAI,EAAE,OAAc,EAAE,EAAE,YAAY,+BA+E7D"}
|
package/dist/index.js
CHANGED
|
@@ -4966,12 +4966,16 @@ function linkedFrom(object, options) {
|
|
|
4966
4966
|
function linkStateFrom(object, unread, options) {
|
|
4967
4967
|
if (object === void 0) return { state: "loading", kind: unread.kind };
|
|
4968
4968
|
const written = unread.url ? { url: unread.url } : {};
|
|
4969
|
-
|
|
4969
|
+
const why = unread.deleted ? { deleted: true } : unread.failed ? { failed: true } : {};
|
|
4970
|
+
if (object === null) return { state: "unavailable", kind: unread.kind, noun: unread.noun, ...why, ...written };
|
|
4970
4971
|
if (object.unreachable) {
|
|
4972
|
+
const noun = nounOf(object);
|
|
4971
4973
|
return {
|
|
4972
4974
|
state: "unavailable",
|
|
4973
4975
|
kind: linkedKindOfKind(object.kind),
|
|
4974
|
-
noun:
|
|
4976
|
+
noun: noun || unread.noun,
|
|
4977
|
+
// Its app's name, its type having none: "You can't open this file in Notes".
|
|
4978
|
+
...noun && !object.noun ? { named: true } : {},
|
|
4975
4979
|
...written
|
|
4976
4980
|
};
|
|
4977
4981
|
}
|
|
@@ -5122,9 +5126,10 @@ import { useContext as useContext11 } from "react";
|
|
|
5122
5126
|
import { useContext as useContext10 } from "react";
|
|
5123
5127
|
import { jsx as jsx64, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
5124
5128
|
var ROW_CLASSES2 = "flex items-center gap-3 p-1.5 pr-3";
|
|
5125
|
-
function LinkUnavailable({ kind, noun, card = false, deleted = false }) {
|
|
5126
|
-
const word = /^[A-Z][a-z]*$/.test(noun) ? noun.toLowerCase() : noun;
|
|
5127
|
-
|
|
5129
|
+
function LinkUnavailable({ kind, noun, named: named2 = false, card = false, deleted = false, failed = false }) {
|
|
5130
|
+
const word = named2 ? `file in ${noun}` : /^[A-Z][a-z]*$/.test(noun) ? noun.toLowerCase() : noun;
|
|
5131
|
+
const words = deleted ? `${named2 ? `File in ${noun}` : noun} deleted` : failed ? `Couldn't load this ${word}` : `You can't open this ${word}`;
|
|
5132
|
+
return /* @__PURE__ */ jsx64(UnavailableRow, { kind, words, card });
|
|
5128
5133
|
}
|
|
5129
5134
|
function UnavailableRow({ kind, words, href, card = false }) {
|
|
5130
5135
|
const wide = useContext10(inTheBox);
|
|
@@ -5153,7 +5158,7 @@ function LinkRow({ link, preview = true }) {
|
|
|
5153
5158
|
}
|
|
5154
5159
|
if (link.state === "unavailable") {
|
|
5155
5160
|
if (link.url) return /* @__PURE__ */ jsx64(WrittenUrl, { url: link.url, block: true });
|
|
5156
|
-
return /* @__PURE__ */ jsx64(LinkUnavailable, { kind: link.kind, noun: link.noun, deleted: link.deleted });
|
|
5161
|
+
return /* @__PURE__ */ jsx64(LinkUnavailable, { kind: link.kind, noun: link.noun, named: link.named, deleted: link.deleted, failed: link.failed });
|
|
5157
5162
|
}
|
|
5158
5163
|
const { linked } = link;
|
|
5159
5164
|
const status = chosenOf(linked.status);
|
|
@@ -5198,7 +5203,7 @@ function LinkCard({ link, readOnly = false, bare = false }) {
|
|
|
5198
5203
|
if (link.state === "loading") return /* @__PURE__ */ jsx65(LinkCardLoading, { kind: link.kind, shape: link.shape });
|
|
5199
5204
|
if (link.state === "unavailable") {
|
|
5200
5205
|
if (link.url) return /* @__PURE__ */ jsx65(WrittenUrl, { url: link.url, block: true });
|
|
5201
|
-
return /* @__PURE__ */ jsx65(LinkUnavailable, { kind: link.kind, noun: link.noun, deleted: link.deleted, card: true });
|
|
5206
|
+
return /* @__PURE__ */ jsx65(LinkUnavailable, { kind: link.kind, noun: link.noun, named: link.named, deleted: link.deleted, failed: link.failed, card: true });
|
|
5202
5207
|
}
|
|
5203
5208
|
const { linked } = link;
|
|
5204
5209
|
const body = linked.kind === "message" && linked.author ? /* @__PURE__ */ jsx65(SaidBody, { linked }) : /* @__PURE__ */ jsx65(CardBody, { linked, readOnly: readOnly || boxed });
|