@swiftbrowser/react 0.17.5 → 0.17.6
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/README.md +8 -4
- package/dist/components/images.d.ts +7 -2
- package/dist/components/images.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -404,12 +404,16 @@ webInteractions />` gives a remote picture the browser's own image
|
|
|
404
404
|
interactions back: a long press's Save / Share / Copy on iOS, dragging it
|
|
405
405
|
out of the page, the right-click menu. Use it on an image with no tap,
|
|
406
406
|
gesture or context menu of its own. `placeholder` shows until the image
|
|
407
|
-
loaded
|
|
408
|
-
`failure` when it could not, and `loadingIndicator` goes over the
|
|
407
|
+
loaded, `failure` when it could not, and `loadingIndicator` goes over the
|
|
409
408
|
placeholder once a load has run for `loadingIndicatorDelay` ms (300 by
|
|
410
409
|
default): a `<ProgressView />` for a big picture on a slow connection,
|
|
411
|
-
nothing for one that comes quickly or from the cache.
|
|
412
|
-
|
|
410
|
+
nothing for one that comes quickly or from the cache. The image's
|
|
411
|
+
modifiers apply in every phase, as a SwiftUI `AsyncImage`'s do: a
|
|
412
|
+
thumbnail with `frame={{ width: 72, height: 48 }}` keeps its box while it
|
|
413
|
+
loads (with no placeholder, an empty one), so the text beside it does not
|
|
414
|
+
move when the picture arrives; a `placeholder` at the picture's aspect
|
|
415
|
+
ratio does the same for a picture drawn at its own shape. All three show
|
|
416
|
+
in a SwiftBrowser Native app too.
|
|
413
417
|
|
|
414
418
|
`keyboardType`, `textContentType`, `textInputAutocapitalization` and
|
|
415
419
|
`autocorrectionDisabled` are SwiftUI's text input hints, for the field they
|
|
@@ -6,9 +6,14 @@ export interface AsyncImageProps extends ViewModifiers {
|
|
|
6
6
|
url: string;
|
|
7
7
|
/** `.resizable()` on the loaded image. */
|
|
8
8
|
resizable?: boolean;
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Shown until the image loaded (nothing by default). The image's modifiers
|
|
11
|
+
* (its frame, aspect ratio, corner radius) apply to it as they do to the
|
|
12
|
+
* picture, as a SwiftUI `AsyncImage`'s do in every phase: a framed image
|
|
13
|
+
* keeps its box while it loads, so the row beside it does not move.
|
|
14
|
+
*/
|
|
10
15
|
placeholder?: ReactNode;
|
|
11
|
-
/** Shown when the image failed to load (the placeholder by default). */
|
|
16
|
+
/** Shown when the image failed to load (the placeholder by default), under the same modifiers. */
|
|
12
17
|
failure?: ReactNode;
|
|
13
18
|
/**
|
|
14
19
|
* Shown over the placeholder once a load has run for `loadingIndicatorDelay`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"images.d.ts","sourceRoot":"","sources":["../../src/components/images.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,EAA8B,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAG9E,4DAA4D;AAC5D,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAE9C,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACpD,GAAG,EAAE,MAAM,CAAC;IACZ,0CAA0C;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB
|
|
1
|
+
{"version":3,"file":"images.d.ts","sourceRoot":"","sources":["../../src/components/images.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,EAA8B,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAG9E,4DAA4D;AAC5D,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAE9C,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACpD,GAAG,EAAE,MAAM,CAAC;IACZ,0CAA0C;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,kGAAkG;IAClG,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oEAAoE;IACpE,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC;AAmBD;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,SAAS,CA2D5D"}
|
package/dist/index.js
CHANGED
|
@@ -3450,14 +3450,14 @@ function AsyncImage(props) {
|
|
|
3450
3450
|
return applyModifiers(sb("image", { ...imageProps(own), url: own.url, width: 0, height: 0 }), modifiers);
|
|
3451
3451
|
}
|
|
3452
3452
|
if (state === null) {
|
|
3453
|
-
const placeholder2 = own.placeholder ??
|
|
3454
|
-
|
|
3455
|
-
return /* @__PURE__ */ jsxs(ZStack, { children: [
|
|
3453
|
+
const placeholder2 = own.placeholder ?? /* @__PURE__ */ jsx(ZStack, {});
|
|
3454
|
+
const shown = slow && hasIndicator ? /* @__PURE__ */ jsxs(ZStack, { children: [
|
|
3456
3455
|
placeholder2,
|
|
3457
3456
|
own.loadingIndicator
|
|
3458
|
-
] });
|
|
3457
|
+
] }) : placeholder2;
|
|
3458
|
+
return applyModifiers(shown, modifiers);
|
|
3459
3459
|
}
|
|
3460
|
-
if (state === "failed") return own.failure ?? own.placeholder ??
|
|
3460
|
+
if (state === "failed") return applyModifiers(own.failure ?? own.placeholder ?? /* @__PURE__ */ jsx(ZStack, {}), modifiers);
|
|
3461
3461
|
return applyModifiers(sb("image", { ...imageProps(own), url: state.url, width: state.width, height: state.height }), modifiers);
|
|
3462
3462
|
}
|
|
3463
3463
|
function imageProps(own) {
|