@devvit/splash 0.11.19-next-2025-07-22-23-31-05-5dbdec031.0 → 0.11.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devvit/splash",
3
- "version": "0.11.19-next-2025-07-22-23-31-05-5dbdec031.0",
3
+ "version": "0.11.19",
4
4
  "license": "BSD-3-Clause",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,12 +22,9 @@
22
22
  "test:unit-with-coverage": "vitest run --coverage"
23
23
  },
24
24
  "types": "./index.d.ts",
25
- "dependencies": {
26
- "@devvit/public-api": "0.11.19-next-2025-07-22-23-31-05-5dbdec031.0"
27
- },
28
25
  "devDependencies": {
29
- "@devvit/repo-tools": "0.11.19-next-2025-07-22-23-31-05-5dbdec031.0",
30
- "@devvit/tsconfig": "0.11.19-next-2025-07-22-23-31-05-5dbdec031.0",
26
+ "@devvit/repo-tools": "0.11.19",
27
+ "@devvit/tsconfig": "0.11.19",
31
28
  "eslint": "9.11.1",
32
29
  "typescript": "5.8.3",
33
30
  "vitest": "1.6.1"
@@ -36,5 +33,5 @@
36
33
  "directory": "dist"
37
34
  },
38
35
  "source": "./src/index.ts",
39
- "gitHead": "82291dc66b74ac3811ddbddd85cc42a9e1fe6442"
36
+ "gitHead": "f730f695127ca675c4c651e691b9475e35e91ca2"
40
37
  }
package/app-icon.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export type AppIconProps = {
2
- name: string;
3
- imageURL?: string | undefined;
4
- };
5
- export declare function AppIcon(props: AppIconProps): JSX.Element;
6
- //# sourceMappingURL=app-icon.d.ts.map
package/app-icon.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"app-icon.d.ts","sourceRoot":"","sources":["../src/app-icon.tsx"],"names":[],"mappings":"AAMA,MAAM,MAAM,YAAY,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAE3E,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO,CA8CxD"}
package/app-icon.js DELETED
@@ -1,12 +0,0 @@
1
- import { Devvit } from '@devvit/public-api';
2
- import { iconShadowURL } from './utils/assets.js';
3
- import { getColor } from './utils/color-util.js';
4
- import { getAbbreviation } from './utils/get-abbreviation.js';
5
- export function AppIcon(props) {
6
- return (Devvit.createElement("zstack", { height: "96px", width: "96px", alignment: "center middle" },
7
- Devvit.createElement("image", { url: iconShadowURL, imageWidth: 192, imageHeight: 192, height: "100%", width: "100%", description: "Icon shadow" }),
8
- !!props.imageURL && (Devvit.createElement("zstack", { height: "64px", width: "64px", alignment: "center middle", cornerRadius: "medium" },
9
- Devvit.createElement("image", { url: props.imageURL, imageWidth: 256, imageHeight: 256, height: "100%", width: "100%", description: `${props.name} icon` }))),
10
- !props.imageURL && (Devvit.createElement("zstack", { height: "64px", width: "64px", backgroundColor: getColor(props.name), borderColor: "rgba(0, 0, 0, 0.1)", border: "thin", cornerRadius: "medium", alignment: "center middle" },
11
- Devvit.createElement("text", { size: "xxlarge", color: "white", weight: "bold" }, getAbbreviation(props.name))))));
12
- }
package/loading.d.ts DELETED
@@ -1,16 +0,0 @@
1
- export type LoadingProps = {
2
- /**
3
- * Application name.
4
- *
5
- * @example `'Comment Mop'`.
6
- */
7
- appDisplayName: string;
8
- /**
9
- * Media directory relative background image URL or data URI.
10
- *
11
- * @example `'background.png'`.
12
- */
13
- backgroundURI?: string | undefined;
14
- };
15
- export declare function Loading(props: Readonly<LoadingProps>): JSX.Element;
16
- //# sourceMappingURL=loading.d.ts.map
package/loading.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"loading.d.ts","sourceRoot":"","sources":["../src/loading.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,YAAY,GAAG;IACzB;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC,CAAC;AAEF,wBAAgB,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,GAAG,CAAC,OAAO,CAYlE"}
package/loading.js DELETED
@@ -1,5 +0,0 @@
1
- import { Devvit } from '@devvit/public-api';
2
- import { backgroundURL } from './utils/assets.js';
3
- export function Loading(props) {
4
- return (Devvit.createElement("image", { url: props.backgroundURI ?? backgroundURL, imageWidth: 2048, imageHeight: 1024, height: "100%", width: "100%", resizeMode: "cover", description: `${props.appDisplayName} loading screen` }));
5
- }
package/splash.d.ts DELETED
@@ -1,30 +0,0 @@
1
- import { type LoadingProps } from './loading.js';
2
- /** Aligns to SplashPostData. */
3
- export type SplashProps = {
4
- /**
5
- * Icon URL relative media directory or data URI.
6
- *
7
- * @example `'icon.png'`.
8
- */
9
- appIconURI?: string | undefined;
10
- /** The text of the web view launch button. */
11
- buttonLabel?: string | undefined;
12
- /** Secondary text describing the post. */
13
- description?: string | undefined;
14
- /**
15
- * Web view URL relative client directory.
16
- *
17
- * @example `'game.html'`.
18
- * @default `'index.html'`.
19
- */
20
- entryURL?: string | undefined;
21
- /**
22
- * Large text naming the post.
23
- *
24
- * @example `'What is this?'`.
25
- * @default `appDisplayName`.
26
- */
27
- title?: string | undefined;
28
- } & LoadingProps;
29
- export declare function Splash(props: Readonly<SplashProps>): JSX.Element;
30
- //# sourceMappingURL=splash.d.ts.map
package/splash.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"splash.d.ts","sourceRoot":"","sources":["../src/splash.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAE1D,gCAAgC;AAChC,MAAM,MAAM,WAAW,GAAG;IACxB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,GAAG,YAAY,CAAC;AAEjB,wBAAgB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,GAAG,CAAC,OAAO,CAkChE"}
package/splash.js DELETED
@@ -1,16 +0,0 @@
1
- import { Devvit, useWebView } from '@devvit/public-api';
2
- import { AppIcon } from './app-icon.js';
3
- import { Loading } from './loading.js';
4
- export function Splash(props) {
5
- const webView = useWebView({ url: props.entryURL ?? 'index.html', onMessage() { } });
6
- return (Devvit.createElement("zstack", { height: "100%", width: "100%" },
7
- Devvit.createElement(Loading, { ...props }),
8
- Devvit.createElement("vstack", { height: "100%", width: "100%", alignment: "center middle", padding: "medium" },
9
- Devvit.createElement(AppIcon, { name: props.appDisplayName, imageURL: props.appIconURI }),
10
- Devvit.createElement("text", { size: "xxlarge", weight: "bold", color: "neutral-content-strong", width: "100%", alignment: "center", wrap: true }, props.title ?? props.appDisplayName),
11
- Devvit.createElement("spacer", { height: "4px" }),
12
- Devvit.createElement("text", { size: "large", color: "neutral-content", width: "100%", alignment: "center", wrap: true }, props.description ?? ''),
13
- Devvit.createElement("spacer", { height: "16px" }),
14
- Devvit.createElement("button", { appearance: "primary", size: "medium", onPress: webView.mount }, props.buttonLabel ?? 'Launch App'),
15
- Devvit.createElement("spacer", { height: "16px" }))));
16
- }
package/utils/assets.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export declare const iconShadowURL: string;
2
- export declare const backgroundURL: string;
3
- //# sourceMappingURL=assets.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../src/utils/assets.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,aAAa,EAAE,MAA8C,CAAC;AAG3E,eAAO,MAAM,aAAa,EAAE,MAA8C,CAAC"}
package/utils/assets.js DELETED
@@ -1,4 +0,0 @@
1
- // https://github.snooguts.net/knut-synstad/splash-screen/blob/f6d6816/assets/icon-shadow.png
2
- export const iconShadowURL = 'https://i.redd.it/53aztgp96pdf1.png';
3
- // https://github.snooguts.net/knut-synstad/splash-screen/blob/f6d6816/assets/pattern-background.png
4
- export const backgroundURL = 'https://i.redd.it/cpsxzbp96pdf1.png';
@@ -1,8 +0,0 @@
1
- /**
2
- * Returns the background and border colors for a given name
3
- * @param name - The name to get the colors for
4
- * @returns The background and border colors as HSL strings
5
- */
6
- export declare function getColor(name: string): string;
7
- export declare function hslToHex(h: number, s: number, l: number): string;
8
- //# sourceMappingURL=color-util.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"color-util.d.ts","sourceRoot":"","sources":["../../src/utils/color-util.ts"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQ7C;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAmChE"}
@@ -1,57 +0,0 @@
1
- // Color constraints
2
- import { hashString, normalize } from './hash.js';
3
- // We're aiming for a pastel color with sufficient constrast against white text
4
- const minHue = 0;
5
- const maxHue = 360;
6
- const minSaturation = 55;
7
- const maxSaturation = 75;
8
- const minLightness = 30;
9
- const maxLightness = 35;
10
- /**
11
- * Returns the background and border colors for a given name
12
- * @param name - The name to get the colors for
13
- * @returns The background and border colors as HSL strings
14
- */
15
- export function getColor(name) {
16
- const nameHash = hashString(name);
17
- const hue = normalize(nameHash, minHue, maxHue);
18
- const saturation = normalize(nameHash, minSaturation, maxSaturation);
19
- const lightness = normalize(nameHash, minLightness, maxLightness);
20
- return hslToHex(hue, saturation, lightness);
21
- }
22
- export function hslToHex(h, s, l) {
23
- // Convert HSL to RGB
24
- h /= 360; // Hue is typically 0-360, convert to 0-1
25
- s /= 100; // Saturation is 0-100%, convert to 0-1
26
- l /= 100; // Lightness is 0-100%, convert to 0-1
27
- let r, g, b;
28
- if (s === 0) {
29
- r = g = b = l; // achromatic
30
- }
31
- else {
32
- const hue2rgb = (p, q, t) => {
33
- if (t < 0)
34
- t += 1;
35
- if (t > 1)
36
- t -= 1;
37
- if (t < 1 / 6)
38
- return p + (q - p) * 6 * t;
39
- if (t < 1 / 2)
40
- return q;
41
- if (t < 2 / 3)
42
- return p + (q - p) * (2 / 3 - t) * 6;
43
- return p;
44
- };
45
- const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
46
- const p = 2 * l - q;
47
- r = hue2rgb(p, q, h + 1 / 3);
48
- g = hue2rgb(p, q, h);
49
- b = hue2rgb(p, q, h - 1 / 3);
50
- }
51
- // Convert RGB to Hex
52
- const toHex = (c) => {
53
- const hex = Math.round(c * 255).toString(16);
54
- return hex.length === 1 ? '0' + hex : hex;
55
- };
56
- return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
57
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"color-util.test.d.ts","sourceRoot":"","sources":["../../src/utils/color-util.test.ts"],"names":[],"mappings":""}
@@ -1,8 +0,0 @@
1
- /**
2
- * Returns an abbreviation for a given name
3
- * @param name - The name to get an abbreviation for
4
- * @param maxLength - The maximum length of the abbreviation (default: 2)
5
- * @returns The abbreviation (uppercase)
6
- */
7
- export declare function getAbbreviation(name: string): string;
8
- //# sourceMappingURL=get-abbreviation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-abbreviation.d.ts","sourceRoot":"","sources":["../../src/utils/get-abbreviation.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAoBpD"}
@@ -1,24 +0,0 @@
1
- const maxLen = 2;
2
- /**
3
- * Returns an abbreviation for a given name
4
- * @param name - The name to get an abbreviation for
5
- * @param maxLength - The maximum length of the abbreviation (default: 2)
6
- * @returns The abbreviation (uppercase)
7
- */
8
- export function getAbbreviation(name) {
9
- const words = name.split(' ').filter(Boolean);
10
- // If there's more than one word and maxLength is greater than 1,
11
- // return the first maxLength letters from the first maxLength words
12
- // Example: "Event Cape Hack" -> "EC"
13
- if (words.length > 1 && maxLen > 1) {
14
- return (words
15
- .slice(0, maxLen)
16
- .map((word) => Array.from(word)[0])
17
- .join('')
18
- .toLocaleUpperCase() || '??');
19
- }
20
- // If there's only one word or maxLength is 1,
21
- // return the first maxLength letters
22
- // Example: "Event" -> "EV"
23
- return Array.from(name.trim()).slice(0, maxLen).join('').toLocaleUpperCase() || '??';
24
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-abbreviation.test.d.ts","sourceRoot":"","sources":["../../src/utils/get-abbreviation.test.ts"],"names":[],"mappings":""}
package/utils/hash.d.ts DELETED
@@ -1,10 +0,0 @@
1
- /**
2
- * Creates a 32bit hash code from a string
3
- *
4
- * @param str The string to hash.
5
- * @return A 32bit integer
6
- * @see https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript
7
- */
8
- export declare function hashString(str: string): number;
9
- export declare function normalize(val: number, min: number, max: number): number;
10
- //# sourceMappingURL=hash.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../src/utils/hash.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAU9C;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEvE"}
package/utils/hash.js DELETED
@@ -1,19 +0,0 @@
1
- /**
2
- * Creates a 32bit hash code from a string
3
- *
4
- * @param str The string to hash.
5
- * @return A 32bit integer
6
- * @see https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript
7
- */
8
- export function hashString(str) {
9
- let hash = 0;
10
- for (let i = 0, len = str.length; i < len; i++) {
11
- const chr = str.charCodeAt(i);
12
- hash = (hash << 5) - hash + chr;
13
- hash |= 0; // Convert to 32bit integer
14
- }
15
- return hash;
16
- }
17
- export function normalize(val, min, max) {
18
- return Math.floor((val % (max - min)) + min);
19
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"hash.test.d.ts","sourceRoot":"","sources":["../../src/utils/hash.test.ts"],"names":[],"mappings":""}