@octane-xplat/gif 0.1.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.
@@ -0,0 +1,36 @@
1
+ import { defineUniversalComponent, registerElement, universalPlan, universalValue } from "@nativescript-community/octane";
2
+ import { Img } from "@nativescript-community/ui-image";
3
+ //#region src/AnimatedImage.native.tsrx
4
+ var __octaneUniversalPlan0 = universalPlan("nativescript", {
5
+ "kind": "host",
6
+ "type": "animatedimage",
7
+ "props": {
8
+ "animatedImageView": true,
9
+ "autoPlayAnimations": true
10
+ },
11
+ "bindings": [
12
+ ["id", 0],
13
+ ["className", 1],
14
+ ["style", 2],
15
+ ["src", 3],
16
+ ["stretch", 4],
17
+ ["width", 5],
18
+ ["height", 6],
19
+ ["accessibilityLabel", 7]
20
+ ]
21
+ });
22
+ registerElement("animatedimage", Img);
23
+ var AnimatedImage = defineUniversalComponent("nativescript", function AnimatedImage(props) {
24
+ return universalValue(__octaneUniversalPlan0, [
25
+ props.id,
26
+ props.className,
27
+ props.style,
28
+ props.src,
29
+ props.stretch ?? "aspectFit",
30
+ props.width,
31
+ props.height,
32
+ props.alt
33
+ ]);
34
+ }, { "module": "@nativescript-community/octane" });
35
+ //#endregion
36
+ export { AnimatedImage };
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 1,
3
+ "buildId": "6d4d5e50-5abb-4b45-9287-419436cba763",
4
+ "mode": "production",
5
+ "capabilities": {
6
+ "independentHydration": false
7
+ }
8
+ }
@@ -0,0 +1,38 @@
1
+ import { __s, bag6, clone, setStyle, template } from "octane";
2
+ import { bindSignalAttribute, enableSignalBindings, setPlainAttribute, setURLAttribute } from "octane/internal/client";
3
+ //#region src/AnimatedImage.web.tsrx
4
+ enableSignalBindings(1, true);
5
+ var _t$0 = /* @__PURE__ */ template("<img/>");
6
+ var OBJECT_FIT = {
7
+ none: "none",
8
+ fill: "fill",
9
+ aspectFit: "contain",
10
+ aspectFill: "cover"
11
+ };
12
+ var AnimatedImage = /* @__PURE__ */ __s(function AnimatedImage(props, __s, __extra) {
13
+ let _b = __s.slots[0];
14
+ if (_b === void 0) {
15
+ let _m1;
16
+ const _root = clone(_t$0);
17
+ _m1 = _root;
18
+ _b = bag6(__s, _root, void 0, _m1, void 0, void 0, void 0, void 0);
19
+ }
20
+ _b.a = bindSignalAttribute(__s, _b.a, _b.b, "id", props.id, "b:42ec7ee7", setPlainAttribute);
21
+ _b.c = bindSignalAttribute(__s, _b.c, _b.b, "class", props.className, "b:1b1f2715", "class");
22
+ {
23
+ const _v = {
24
+ objectFit: OBJECT_FIT[props.stretch ?? "aspectFit"],
25
+ width: props.width,
26
+ height: props.height,
27
+ ...props.style
28
+ };
29
+ if (_b.d !== _v) {
30
+ setStyle(_b.b, _v, _b.d);
31
+ _b.d = _v;
32
+ }
33
+ }
34
+ _b.e = bindSignalAttribute(__s, _b.e, _b.b, "src", props.src, "b:3d7475fa", setURLAttribute);
35
+ _b.f = bindSignalAttribute(__s, _b.f, _b.b, "alt", props.alt, "b:3f7e4d1f", setPlainAttribute);
36
+ });
37
+ //#endregion
38
+ export { AnimatedImage };
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 1,
3
+ "buildId": "bdcff4a8-56d9-4b9d-82b0-696a3d259344",
4
+ "mode": "production",
5
+ "capabilities": {
6
+ "independentHydration": false
7
+ }
8
+ }
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@octane-xplat/gif",
3
+ "version": "0.1.0",
4
+ "description": "Animated image (GIF/animated webp) leaf for Octane xplat — web <img> + @nativescript-community/ui-image",
5
+ "files": [
6
+ "dist",
7
+ "types",
8
+ "src"
9
+ ],
10
+ "type": "module",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./types/index.d.ts",
14
+ "web": "./dist/web/index.js",
15
+ "native": "./dist/native/index.js",
16
+ "default": "./dist/native/index.js"
17
+ }
18
+ },
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "dependencies": {
23
+ "@nativescript-community/ui-image": "4.6.20"
24
+ },
25
+ "devDependencies": {
26
+ "@nativescript-community/octane": "0.2.1",
27
+ "@nativescript/core": "9.1.2",
28
+ "@octanejs/vite-plugin": "0.1.60",
29
+ "octane": "0.5.0",
30
+ "typescript": "5.9.3",
31
+ "vite": "8.3.0"
32
+ },
33
+ "peerDependencies": {
34
+ "@nativescript-community/octane": ">=0.2.1 <1",
35
+ "@nativescript/core": ">=9.1.0 <10",
36
+ "octane": ">=0.1.51 <1"
37
+ },
38
+ "peerDependenciesMeta": {
39
+ "@nativescript-community/octane": {
40
+ "optional": true
41
+ },
42
+ "@nativescript/core": {
43
+ "optional": true
44
+ }
45
+ },
46
+ "scripts": {
47
+ "build": "vite build && vite build --mode native && tsc -p tsconfig.types.json"
48
+ }
49
+ }
@@ -0,0 +1,35 @@
1
+ /** @jsxImportSource @nativescript-community/octane */
2
+ import { registerElement } from '@nativescript-community/octane';
3
+ import type { Attributes } from '@nativescript-community/octane/intrinsics';
4
+ import { Img } from '@nativescript-community/ui-image';
5
+ import type { AnimatedImageProps } from './props';
6
+
7
+ declare module '@nativescript-community/octane/intrinsics' {
8
+ interface NativeScriptElements {
9
+ animatedimage: Attributes<typeof Img>;
10
+ }
11
+ }
12
+
13
+ // @nativescript-community/ui-image — Fresco DraweeView on Android,
14
+ // SDAnimatedImageView on iOS when `animatedImageView` is set (plain UIImageView
15
+ // otherwise, which would still decode but not animate).
16
+ registerElement('animatedimage', Img);
17
+
18
+ /** AnimatedImage — GIF/animated-webp decode + autoplay via ui-image. `src`
19
+ * takes the Img grammar: remote URL, res://name, ~/bundle path, file path.
20
+ * There is intentionally no play/pause prop — <img> can't pause on web, so
21
+ * the shared contract is always-playing. */
22
+ export function AnimatedImage(props: AnimatedImageProps) @{
23
+ <animatedimage
24
+ id={props.id}
25
+ className={props.className}
26
+ style={props.style}
27
+ src={props.src}
28
+ stretch={props.stretch ?? 'aspectFit'}
29
+ width={props.width}
30
+ height={props.height}
31
+ animatedImageView={true}
32
+ autoPlayAnimations={true}
33
+ accessibilityLabel={props.alt}
34
+ />
35
+ }
@@ -0,0 +1,25 @@
1
+ import type { AnimatedImageProps } from './props';
2
+
3
+ const OBJECT_FIT = {
4
+ none: 'none',
5
+ fill: 'fill',
6
+ aspectFit: 'contain',
7
+ aspectFill: 'cover',
8
+ } as const;
9
+
10
+ /** AnimatedImage — a plain <img>; browsers animate GIF/webp natively.
11
+ * `stretch` maps to object-fit. */
12
+ export function AnimatedImage(props: AnimatedImageProps) @{
13
+ <img
14
+ id={props.id}
15
+ className={props.className}
16
+ style={{
17
+ objectFit: OBJECT_FIT[props.stretch ?? 'aspectFit'],
18
+ width: props.width,
19
+ height: props.height,
20
+ ...props.style,
21
+ }}
22
+ src={props.src}
23
+ alt={props.alt}
24
+ />
25
+ }
@@ -0,0 +1,4 @@
1
+ // Platform barrels — explicit .tsrx leaf imports (moduleSuffixes don't
2
+ // reach .tsrx; same convention as @octane-xplat/ui index.*.ts).
3
+ export { AnimatedImage } from './AnimatedImage.native.tsrx';
4
+ export type { AnimatedImageProps } from './props';
@@ -0,0 +1,4 @@
1
+ // Platform barrels — explicit .tsrx leaf imports (moduleSuffixes don't
2
+ // reach .tsrx; same convention as @octane-xplat/ui index.*.ts).
3
+ export { AnimatedImage } from './AnimatedImage.web.tsrx';
4
+ export type { AnimatedImageProps } from './props';
package/src/props.ts ADDED
@@ -0,0 +1,12 @@
1
+ export interface AnimatedImageProps {
2
+ className?: any
3
+ style?: any
4
+ id?: string
5
+ src: string
6
+ alt?: string
7
+ /** Content fit — same grammar as core Image. Web maps to object-fit;
8
+ * ui-image (Fresco/SDWebImage) accepts the same values. */
9
+ stretch?: 'none' | 'fill' | 'aspectFit' | 'aspectFill'
10
+ width?: string | number
11
+ height?: string | number
12
+ }
@@ -0,0 +1,8 @@
1
+ // Boundary types for @octane-xplat/gif — the mechanical wrapper over
2
+ // props.ts (tsrx-tsc can't emit .tsrx declarations; see ui/types/index.d.ts
3
+ // for the same pattern).
4
+ import type { UniversalComponent } from 'octane/universal'
5
+ import type { AnimatedImageProps } from './props'
6
+
7
+ export declare const AnimatedImage: UniversalComponent<AnimatedImageProps>
8
+ export type { AnimatedImageProps }
@@ -0,0 +1,12 @@
1
+ export interface AnimatedImageProps {
2
+ className?: any;
3
+ style?: any;
4
+ id?: string;
5
+ src: string;
6
+ alt?: string;
7
+ /** Content fit — same grammar as core Image. Web maps to object-fit;
8
+ * ui-image (Fresco/SDWebImage) accepts the same values. */
9
+ stretch?: 'none' | 'fill' | 'aspectFit' | 'aspectFill';
10
+ width?: string | number;
11
+ height?: string | number;
12
+ }