@indietabletop/appkit 3.2.0-0 → 3.2.0-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/client.d.ts +1 -1
- package/dist/client.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/use-form.d.ts +1 -1
- package/dist/use-form.js +1 -1
- package/package.json +6 -5
- package/dist/IndieTabletopClubFooter.d.ts +0 -1
- package/dist/IndieTabletopClubFooter.js +0 -17
- package/dist/defineNetlifyConfig.d.ts +0 -34
- package/dist/defineNetlifyConfig.js +0 -35
- package/dist/external-link.d.ts +0 -4
- package/dist/external-link.js +0 -4
- package/dist/form-submit-button.d.ts +0 -7
- package/dist/form-submit-button.js +0 -16
- package/dist/fullscreen-dismiss-blocker.d.ts +0 -5
- package/dist/fullscreen-dismiss-blocker.js +0 -19
- package/dist/service-worker-handler.d.ts +0 -11
- package/dist/service-worker-handler.js +0 -42
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Failure, Success } from "@indietabletop/appkit/async-op";
|
|
2
1
|
import { type Infer, Struct } from "superstruct";
|
|
2
|
+
import { Failure, Success } from "./async-op.js";
|
|
3
3
|
import type { CurrentUser, FailurePayload, SessionInfo } from "./types.js";
|
|
4
4
|
export declare class IndieTabletopClient {
|
|
5
5
|
origin: string;
|
package/dist/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Failure, Success } from "@indietabletop/appkit/async-op";
|
|
2
1
|
import { mask, object, string, Struct } from "superstruct";
|
|
2
|
+
import { Failure, Success } from "./async-op.js";
|
|
3
3
|
import { currentUser, sessionInfo } from "./structs.js";
|
|
4
4
|
export class IndieTabletopClient {
|
|
5
5
|
constructor(props) {
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from "./ExternalLink.tsx";
|
|
|
2
2
|
export * from "./FormSubmitButton.tsx";
|
|
3
3
|
export * from "./FullscreenDismissBlocker.tsx";
|
|
4
4
|
export * from "./IndieTabletopClubSymbol.tsx";
|
|
5
|
+
export * from "./Letterhead.tsx";
|
|
5
6
|
export * from "./LetterheadFooter.tsx";
|
|
6
7
|
export * from "./LoadingIndicator.tsx";
|
|
7
8
|
export * from "./ServiceWorkerHandler.tsx";
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export * from "./ExternalLink.js";
|
|
|
3
3
|
export * from "./FormSubmitButton.js";
|
|
4
4
|
export * from "./FullscreenDismissBlocker.js";
|
|
5
5
|
export * from "./IndieTabletopClubSymbol.js";
|
|
6
|
+
export * from "./Letterhead.js";
|
|
6
7
|
export * from "./LetterheadFooter.js";
|
|
7
8
|
export * from "./LoadingIndicator.js";
|
|
8
9
|
export * from "./ServiceWorkerHandler.js";
|
package/dist/use-form.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type FormStoreState } from "@ariakit/react";
|
|
2
|
-
import { Failure, Success } from "
|
|
2
|
+
import { Failure, Success } from "./async-op.ts";
|
|
3
3
|
type Validator<T> = (value: T) => string | null;
|
|
4
4
|
type MaybePromise<T> = T | Promise<T>;
|
|
5
5
|
export declare function useForm<T extends object, R>(props: {
|
package/dist/use-form.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useFormStore } from "@ariakit/react";
|
|
2
|
-
import { Failure, Success } from "@indietabletop/appkit/async-op";
|
|
3
2
|
import { useState } from "react";
|
|
3
|
+
import { Failure, Success } from "./async-op.js";
|
|
4
4
|
export function useForm(props) {
|
|
5
5
|
const submitName = "submit";
|
|
6
6
|
const [op, setOp] = useState(null);
|
package/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indietabletop/appkit",
|
|
3
|
-
"version": "3.2.0-
|
|
3
|
+
"version": "3.2.0-2",
|
|
4
4
|
"description": "A collection of modules used in apps built by Indie Tabletop Club",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"release": "
|
|
8
|
+
"release": "np",
|
|
9
9
|
"build": "tsc",
|
|
10
10
|
"dev": "tsc --watch",
|
|
11
|
-
"test": "vitest"
|
|
11
|
+
"test": "vitest",
|
|
12
|
+
"prepare": "npm run build"
|
|
12
13
|
},
|
|
13
14
|
"exports": {
|
|
14
|
-
".": "./
|
|
15
|
-
"./*": "./
|
|
15
|
+
".": "./lib/index.ts",
|
|
16
|
+
"./*": "./lib/*"
|
|
16
17
|
},
|
|
17
18
|
"files": [
|
|
18
19
|
"/dist"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function IndieTabletopClubFooter(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { interactiveText } from "./common.css.js";
|
|
3
|
-
import { ExternalLink } from "./external-link.js";
|
|
4
|
-
import { IndieTabletopClubLogo } from "./IndieTabletopClubLogo.js";
|
|
5
|
-
export function IndieTabletopClubFooter() {
|
|
6
|
-
return (_jsxs("div", { style: {
|
|
7
|
-
textAlign: "center",
|
|
8
|
-
paddingBlockStart: "2rem",
|
|
9
|
-
borderBlockStart: "1px solid #ececec",
|
|
10
|
-
marginBlockStart: "3rem",
|
|
11
|
-
}, children: [_jsx(IndieTabletopClubLogo, { style: { margin: "0 auto 1.125rem" } }), _jsxs("p", { style: {
|
|
12
|
-
margin: "0 auto",
|
|
13
|
-
maxInlineSize: "25rem",
|
|
14
|
-
fontSize: "0.875rem",
|
|
15
|
-
lineHeight: "1.25rem",
|
|
16
|
-
}, children: ["Indie Tabletop Club supports independent game creators with high-quality digital tools.", " ", _jsx(ExternalLink, { href: "https://indietabletop.club", className: interactiveText, children: "Learn more" }), "."] })] }));
|
|
17
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { ConfigEnv, PluginOption, UserConfig } from "vite";
|
|
2
|
-
export declare function defineNetlifyConfig(props: {
|
|
3
|
-
/**
|
|
4
|
-
* The server port number.
|
|
5
|
-
*
|
|
6
|
-
* Game apps start from 8000, automation apps from 9000. So far, we got:
|
|
7
|
-
*
|
|
8
|
-
* - API: 8000
|
|
9
|
-
* - Hobgoblin: 8001
|
|
10
|
-
* - Eternol: 8002
|
|
11
|
-
* - Gregbot: 9000
|
|
12
|
-
*/
|
|
13
|
-
port: number;
|
|
14
|
-
/**
|
|
15
|
-
* By default, react and vanilla extract are always configured.
|
|
16
|
-
*/
|
|
17
|
-
additionalPlugins?: PluginOption[];
|
|
18
|
-
/**
|
|
19
|
-
* Can be used to import from `@` at the path specified here. Has to match
|
|
20
|
-
* tsconfig > compilerOptions > paths.
|
|
21
|
-
*
|
|
22
|
-
* Do not use this, just use relative imports.
|
|
23
|
-
*
|
|
24
|
-
* @deprecated
|
|
25
|
-
*/
|
|
26
|
-
resolveAlias?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Determines whether input is "/index.html", or "index.html" or
|
|
29
|
-
* "/src/main.tsx" depnending on command.
|
|
30
|
-
*
|
|
31
|
-
* This is useful when using pre-rendered HTML as input.
|
|
32
|
-
*/
|
|
33
|
-
conditionalInput?: boolean;
|
|
34
|
-
}): ({ command }: ConfigEnv) => UserConfig;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { vanillaExtractPlugin as vanilla } from "@vanilla-extract/vite-plugin";
|
|
2
|
-
import react from "@vitejs/plugin-react";
|
|
3
|
-
export function defineNetlifyConfig(props) {
|
|
4
|
-
const { additionalPlugins = [], conditionalInput = false, resolveAlias, } = props;
|
|
5
|
-
return function configureVite({ command }) {
|
|
6
|
-
return {
|
|
7
|
-
define: {
|
|
8
|
-
// These vars are supplied by Netlify
|
|
9
|
-
BRANCH: JSON.stringify(process.env.BRANCH),
|
|
10
|
-
COMMIT_SHORTCODE: JSON.stringify(process.env.COMMIT_REF?.slice(0, 7)),
|
|
11
|
-
},
|
|
12
|
-
plugins: [react(), vanilla(), ...additionalPlugins],
|
|
13
|
-
esbuild: {
|
|
14
|
-
target: "es2022",
|
|
15
|
-
},
|
|
16
|
-
server: {
|
|
17
|
-
port: props.port,
|
|
18
|
-
},
|
|
19
|
-
resolve: {
|
|
20
|
-
alias: resolveAlias ? { "@": resolveAlias } : undefined,
|
|
21
|
-
},
|
|
22
|
-
build: {
|
|
23
|
-
sourcemap: true,
|
|
24
|
-
manifest: true,
|
|
25
|
-
rollupOptions: {
|
|
26
|
-
// During `build`, we want to only deal with JS files. Production HTML
|
|
27
|
-
// entrypoint is generated via the `build:entrypoint` package script.
|
|
28
|
-
input: conditionalInput && command === "build"
|
|
29
|
-
? "/src/main.tsx"
|
|
30
|
-
: "/index.html",
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
}
|
package/dist/external-link.d.ts
DELETED
package/dist/external-link.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type FormSubmitProps } from "@ariakit/react";
|
|
2
|
-
import type { ReactNode } from "react";
|
|
3
|
-
export type FormSubmitButtonProps = FormSubmitProps & {
|
|
4
|
-
children: ReactNode;
|
|
5
|
-
loading: ReactNode;
|
|
6
|
-
};
|
|
7
|
-
export declare function FormSubmitButton(props: FormSubmitButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { FormSubmit, useFormContext, useStoreState, } from "@ariakit/react";
|
|
3
|
-
import { fadeIn } from "./animations.css.js";
|
|
4
|
-
export function FormSubmitButton(props) {
|
|
5
|
-
const { children, className, style, loading, ...submitProps } = props;
|
|
6
|
-
const form = useFormContext();
|
|
7
|
-
const isSubmitting = useStoreState(form, (s) => s?.submitting);
|
|
8
|
-
return (_jsxs(FormSubmit, { ...submitProps, className: className, style: { position: "relative", ...style }, children: [_jsx("span", { style: { opacity: isSubmitting ? 0 : 1, transition: "200ms opacity" }, children: children }), isSubmitting && (_jsx("div", { style: {
|
|
9
|
-
display: "flex",
|
|
10
|
-
position: "absolute",
|
|
11
|
-
inset: "0",
|
|
12
|
-
alignItems: "center",
|
|
13
|
-
justifyContent: "center",
|
|
14
|
-
animation: `${fadeIn} 200ms 200ms both`,
|
|
15
|
-
}, children: loading }))] }));
|
|
16
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
function handleKeydown(event) {
|
|
3
|
-
if (event.key === "Escape") {
|
|
4
|
-
event.preventDefault();
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* This component prevents the default MacOS behaviour where a fullscreen window
|
|
9
|
-
* gets minimised by pressing Escape.
|
|
10
|
-
*/
|
|
11
|
-
export function FullscreenDismissBlocker() {
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
window.addEventListener("keydown", handleKeydown);
|
|
14
|
-
return () => {
|
|
15
|
-
window.removeEventListener("keydown", handleKeydown);
|
|
16
|
-
};
|
|
17
|
-
}, []);
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type ReactNode } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* This component handles the installation of a service worker.
|
|
4
|
-
*
|
|
5
|
-
* Currently it doesn't do much, but, eventually, it should provide context
|
|
6
|
-
* to nested components communicating the status of the service worker installation.
|
|
7
|
-
*/
|
|
8
|
-
export declare function ServiceWorkerHandler(props: {
|
|
9
|
-
children: ReactNode;
|
|
10
|
-
path: string;
|
|
11
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect } from "react";
|
|
3
|
-
/**
|
|
4
|
-
* This component handles the installation of a service worker.
|
|
5
|
-
*
|
|
6
|
-
* Currently it doesn't do much, but, eventually, it should provide context
|
|
7
|
-
* to nested components communicating the status of the service worker installation.
|
|
8
|
-
*/
|
|
9
|
-
export function ServiceWorkerHandler(props) {
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
async function registerWorker() {
|
|
12
|
-
// Although modern browsers all support service workers, native app's
|
|
13
|
-
// web views (eg. the Facebook app's embedded browsers) do not.
|
|
14
|
-
if ("serviceWorker" in navigator) {
|
|
15
|
-
try {
|
|
16
|
-
const registration = await navigator.serviceWorker.register(props.path);
|
|
17
|
-
console.info("Service worker registration obtained.");
|
|
18
|
-
registration.addEventListener("updatefound", () => {
|
|
19
|
-
const worker = registration.installing;
|
|
20
|
-
console.info("Installing new service worker.");
|
|
21
|
-
worker?.addEventListener("statechange", ({ target }) => {
|
|
22
|
-
if (target instanceof ServiceWorker) {
|
|
23
|
-
console.info(`Service worker state changed: '${target.state}'.`);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
// In rare cases, service worker installation can fail, e.g. due to network
|
|
30
|
-
// connectivity. There is no need to report the error as there is nothing
|
|
31
|
-
// that can be done to prevent this from occassionally happening.
|
|
32
|
-
console.error(error);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
void registerWorker();
|
|
37
|
-
// Note that it is not necessary to 'cleanup' the registration in
|
|
38
|
-
// the useEffect hook. Calling register() multiple times is a no-op.
|
|
39
|
-
// See https://web.dev/articles/service-workers-registration#subsequent_visits
|
|
40
|
-
}, [props.path]);
|
|
41
|
-
return _jsx(_Fragment, { children: props.children });
|
|
42
|
-
}
|