@avis-studio/mini-app 0.1.0-beta.2 → 0.1.0-beta.3
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 +11 -1
- package/dist/{apps-dWIWlsgx.js → apps-Igq7CNCO.js} +467 -278
- package/dist/index.js +8 -8
- package/dist/react.js +12012 -11853
- package/dist/style.css +1 -1
- package/dist/types/packages/mini-app/src/apps.d.ts +7 -0
- package/dist/types/packages/mini-app/src/index.d.ts +2 -1
- package/dist/types/packages/mini-app/src/react.d.ts +0 -1
- package/dist/types/src/components/illustrations/fly-coins.d.ts +32 -0
- package/dist/types/src/components/ui/scroll-area.d.ts +5 -3
- package/dist/types/src/components/ui/tooltip.d.ts +5 -1
- package/dist/types/src/features/studio/model/app-draft.d.ts +21 -1
- package/dist/types/src/features/studio/model/app-json-schema.d.ts +27 -0
- package/dist/types/src/i18n/en-studio.d.ts +2 -0
- package/dist/types/src/i18n/en.d.ts +2 -0
- package/dist/types/src/i18n/index.d.ts +2 -0
- package/dist/types/src/rules/hover-waits-for-scroll.d.ts +10 -0
- package/dist/types/src/rules/index.d.ts +1 -0
- package/package.json +4 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type AppControl } from "../../../src/features/studio/model/app-controls.js";
|
|
2
|
+
import { type JsonSchema } from "../../../src/features/studio/model/app-json-schema.js";
|
|
2
3
|
import { type AppDraft } from "../../../src/features/studio/model/app-draft.js";
|
|
3
4
|
import type { AvisClient } from "./client.js";
|
|
4
5
|
import { type PropertyControls } from "./property-controls.js";
|
|
@@ -79,6 +80,12 @@ export declare function toDraft(app: MiniApp, values: MiniAppValues): AppDraft;
|
|
|
79
80
|
* prompt, and each upload's URL (several as a list under their key).
|
|
80
81
|
*/
|
|
81
82
|
export declare function fromDraft(draft: AppDraft): MiniAppValues;
|
|
83
|
+
/**
|
|
84
|
+
* A mini app's form as JSON Schema (2020-12): the values `runMiniApp` takes,
|
|
85
|
+
* by key, with the AVIS control kept under `x-avis-*`, so another tool can
|
|
86
|
+
* read, check or fill it.
|
|
87
|
+
*/
|
|
88
|
+
export declare function toJsonSchema(app: MiniApp): JsonSchema;
|
|
82
89
|
/**
|
|
83
90
|
* Runs a mini app with the values of its form on the AVIS API:
|
|
84
91
|
*
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { ControlType, controlProblems, defineAppControls, type AppControl, type AppControlType, type ControlCondition, } from "../../../src/features/studio/model/app-controls.js";
|
|
2
2
|
export type { AppDraft, AppUpload } from "../../../src/features/studio/model/app-draft.js";
|
|
3
|
+
export { JSON_SCHEMA_DIALECT, controlsJsonSchema, type JsonSchema, } from "../../../src/features/studio/model/app-json-schema.js";
|
|
3
4
|
export { addPropertyControls, defaultsOf, propertyControlsOf, toControlList, type LooseControl, type PropertyControl, type PropertyControls, } from "./property-controls.js";
|
|
4
5
|
export { AVIS_API_BASE, createAvisClient, type AvisCall, type AvisClient, type AvisClientOptions, type WaitOptions, } from "./client.js";
|
|
5
|
-
export { allControls, defineMiniApp, fromDraft, miniApps, runMiniApp, startValues, toDraft, type MediaValue, type MiniApp, type MiniAppContext, type MiniAppResult, type MiniAppValues, } from "./apps.js";
|
|
6
|
+
export { allControls, defineMiniApp, fromDraft, miniApps, runMiniApp, startValues, toDraft, toJsonSchema, type MediaValue, type MiniApp, type MiniAppContext, type MiniAppResult, type MiniAppValues, } from "./apps.js";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import "./style.css";
|
|
3
2
|
import type { StudioApp } from "../../../src/features/studio/catalog/apps-config.js";
|
|
4
3
|
import { type AppDraft } from "../../../src/features/studio/model/app-draft.js";
|
|
5
4
|
import type { AvisClient } from "./client.js";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type CoinFlight = {
|
|
2
|
+
/** The option's picture, drawn on the coin. */
|
|
3
|
+
src: string;
|
|
4
|
+
/** Where it lands; a missing target gets no coin. */
|
|
5
|
+
target: HTMLElement | null;
|
|
6
|
+
/** Where it leaves from (else the shared `from` rect); sets the coin's size. */
|
|
7
|
+
from?: Element | null;
|
|
8
|
+
/**
|
|
9
|
+
* Called as the coin lands (at once with reduced motion or no slot), so the
|
|
10
|
+
* slot can show its new picture only then.
|
|
11
|
+
*/
|
|
12
|
+
onLand?: () => void;
|
|
13
|
+
/**
|
|
14
|
+
* `field`: it lands on a whole form field (an app form's "Use this
|
|
15
|
+
* template", owner 2026-11-28): a small coin, no blob, a soft pulse.
|
|
16
|
+
* Default: the landing of the call (`slot` or `merge`).
|
|
17
|
+
*/
|
|
18
|
+
into?: "field";
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* A field pulses once, as a landing coin makes it: to point at it (a form
|
|
22
|
+
* taking one to what it lacks). Nothing under reduced motion.
|
|
23
|
+
*/
|
|
24
|
+
export declare function pulseField(target: HTMLElement): void;
|
|
25
|
+
/**
|
|
26
|
+
* Sends one coin per flight to its target: from its own `from` element, or
|
|
27
|
+
* from across the shared `from` rect (a preset tile).
|
|
28
|
+
*/
|
|
29
|
+
export declare function flyCoins(from: DOMRect | null, flights: readonly CoinFlight[], { reducedMotion, landing, }?: {
|
|
30
|
+
reducedMotion?: boolean;
|
|
31
|
+
landing?: "slot" | "merge";
|
|
32
|
+
}): void;
|
|
@@ -25,7 +25,7 @@ export type ScrollFadeOptions = {
|
|
|
25
25
|
export declare function useScrollAreaFade(ref: React.RefObject<HTMLElement | null>, { orientation, size, shrink, blur, enabled, }?: ScrollFadeOptions): void;
|
|
26
26
|
export declare const scrollAreaViewportVariants: (props?: ({
|
|
27
27
|
overscrollContain?: boolean | null | undefined;
|
|
28
|
-
fade?: "none" | "edge" | "sized" | null | undefined;
|
|
28
|
+
fade?: "end" | "none" | "edge" | "sized" | null | undefined;
|
|
29
29
|
scrollbarGutter?: boolean | null | undefined;
|
|
30
30
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
31
31
|
export type ScrollAreaProps = ScrollAreaPrimitive.Root.Props & {
|
|
@@ -50,9 +50,11 @@ export type ScrollAreaProps = ScrollAreaPrimitive.Root.Props & {
|
|
|
50
50
|
* Options make a fading list: the fade's depth (`size`, default 32px), items
|
|
51
51
|
* that shrink and blur at a faded edge (`shrink`, `blur`, `enabled`; mark
|
|
52
52
|
* lists with `role="group"`), its axis (`orientation`, which the area then
|
|
53
|
-
* scrolls along, vertical by default), and overscroll contained.
|
|
53
|
+
* scrolls along, vertical by default), and overscroll contained. `"end"`:
|
|
54
|
+
* the 1.5rem fade at the bottom and end only, for an area whose top holds
|
|
55
|
+
* a sticky header (an app form's collapsed card; owner, 2026-11-28).
|
|
54
56
|
*/
|
|
55
|
-
scrollFade?: boolean | ScrollFadeOptions;
|
|
57
|
+
scrollFade?: boolean | "end" | ScrollFadeOptions;
|
|
56
58
|
scrollbarGutter?: boolean;
|
|
57
59
|
fill?: boolean;
|
|
58
60
|
/**
|
|
@@ -3,7 +3,11 @@ import { type VariantProps } from "class-variance-authority";
|
|
|
3
3
|
import type React from "react";
|
|
4
4
|
export declare const TooltipCreateHandle: typeof TooltipPrimitive.createHandle;
|
|
5
5
|
export declare const TooltipProvider: typeof TooltipPrimitive.Provider;
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* A tooltip's root. It doesn't open on what passes under a still pointer
|
|
8
|
+
* while the wheel scrolls, and closes when it scrolls (owner, 2026-11-28).
|
|
9
|
+
*/
|
|
10
|
+
export declare function Tooltip({ open: openProp, defaultOpen, onOpenChange, ...props }: TooltipPrimitive.Root.Props): React.ReactElement;
|
|
7
11
|
export declare function TooltipTrigger(props: TooltipPrimitive.Trigger.Props): React.ReactElement;
|
|
8
12
|
export declare const tooltipPopupVariants: (props?: ({
|
|
9
13
|
variant?: "default" | "brand" | "inverse" | null | undefined;
|
|
@@ -78,7 +78,20 @@ export declare function applyPreset(draft: AppDraft, preset: AppPreset): AppDraf
|
|
|
78
78
|
export declare function appMedia(app: StudioApp, choices: Record<string, string>, uploads?: AppDraft["uploads"]): StudioApp["media"];
|
|
79
79
|
/** The run button's words for the Output picked, or null for "Generate". */
|
|
80
80
|
export declare function generateLabelOf(app: StudioApp, choices: Record<string, string>): string | null;
|
|
81
|
-
/**
|
|
81
|
+
/**
|
|
82
|
+
* What the form still lacks before it can run, in the form's order: each
|
|
83
|
+
* required upload with no file (or a file still being checked or uploaded),
|
|
84
|
+
* a template gallery not picked yet, then a required prompt. `key` is the
|
|
85
|
+
* field's (`@prompt` for the prompt), so the form can take one to it.
|
|
86
|
+
*/
|
|
87
|
+
export type FieldProblem = {
|
|
88
|
+
key: string;
|
|
89
|
+
title: string;
|
|
90
|
+
/** No file, still uploading, a gallery to pick from, no prompt. */
|
|
91
|
+
problem: "missing" | "uploading" | "pick" | "prompt";
|
|
92
|
+
};
|
|
93
|
+
export declare function fieldProblems(app: StudioApp, draft: AppDraft): FieldProblem[];
|
|
94
|
+
/** What Generate still needs first: an upload (its title), or the prompt. */
|
|
82
95
|
export declare function draftNeeds(app: StudioApp, draft: AppDraft): {
|
|
83
96
|
upload: string;
|
|
84
97
|
} | "prompt" | null;
|
|
@@ -101,3 +114,10 @@ export declare function keptDraft(draft: AppDraft): AppDraft;
|
|
|
101
114
|
* upload switched off keeps its files in the form, but they aren't sent.
|
|
102
115
|
*/
|
|
103
116
|
export declare function withoutSwitchedOff(draft: AppDraft): AppDraft;
|
|
117
|
+
/**
|
|
118
|
+
* The fields a change to the form touched, by key: each choice that
|
|
119
|
+
* changed, each upload slot whose file changed (`key:1` counts as `key`),
|
|
120
|
+
* and `@prompt` when the prompt did (owner, 2026-11-28: "Use this
|
|
121
|
+
* template"'s coins fly to them).
|
|
122
|
+
*/
|
|
123
|
+
export declare function changedFields(before: AppDraft, after: AppDraft): string[];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type AppControl } from "./app-controls.js";
|
|
2
|
+
/**
|
|
3
|
+
* An app's form as JSON Schema (2020-12), so a tool outside AVIS can read,
|
|
4
|
+
* check or fill it (owner, 2026-11-28). It describes the values a run takes
|
|
5
|
+
* by key, as `runMiniApp` takes them: a file is its URL (or `{ url, name,
|
|
6
|
+
* kind }`), several files a list, a switch a boolean, a number a number,
|
|
7
|
+
* everything else a string. Groups (output settings, Customise, the light)
|
|
8
|
+
* add no level: their controls' values sit under their own keys.
|
|
9
|
+
*
|
|
10
|
+
* What JSON Schema has no word for keeps the AVIS control beside it, under
|
|
11
|
+
* `x-avis-*`: the control type and look, when it hides or locks
|
|
12
|
+
* (`x-avis-hidden`, `x-avis-disabled`, conditions as data), and
|
|
13
|
+
* `x-avis-required` for a field only required while it shows (top-level
|
|
14
|
+
* `required` lists only fields that always show).
|
|
15
|
+
*/
|
|
16
|
+
export type JsonSchema = {
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
};
|
|
19
|
+
export declare const JSON_SCHEMA_DIALECT = "https://json-schema.org/draft/2020-12/schema";
|
|
20
|
+
/** An app's controls as one JSON Schema object of its values. */
|
|
21
|
+
export declare function controlsJsonSchema(controls: readonly AppControl[], about?: {
|
|
22
|
+
id?: string;
|
|
23
|
+
title?: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
/** The values the form starts on (the app's own over the controls'). */
|
|
26
|
+
defaults?: Readonly<Record<string, string>>;
|
|
27
|
+
}): JsonSchema;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Whether the wheel is scrolling now (or just was). */
|
|
2
|
+
export declare function isWheelScrolling(): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Wraps a hover popup's `onOpenChange`: opening while the wheel scrolls is
|
|
5
|
+
* cancelled (Base UI's `eventDetails.cancel()`); while open, a wheel turn
|
|
6
|
+
* outside `inside` (a selector for the popup) closes it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useHoverWaitsForScroll<Details extends {
|
|
9
|
+
cancel: () => void;
|
|
10
|
+
}>(open: boolean, onOpenChange: (open: boolean, details: Details) => void, inside: string): (open: boolean, details: Details) => void;
|
|
@@ -8,6 +8,7 @@ export { useClickToSelect } from "./click-to-select.js";
|
|
|
8
8
|
export { useContainedKeys } from "./contain-keys.js";
|
|
9
9
|
export { isComposerSuspended, pickComposerNode, } from "./composer-visibility.js";
|
|
10
10
|
export { FocusDim } from "./focus-dim.js";
|
|
11
|
+
export { isWheelScrolling, useHoverWaitsForScroll, } from "./hover-waits-for-scroll.js";
|
|
11
12
|
export { useKeepInCanvas, useNodeOnScreen, type KeepInCanvasOptions, } from "./on-screen.js";
|
|
12
13
|
export { usePlacedNode } from "./placed-stays.js";
|
|
13
14
|
export { CanvasCutStroke, useCanvasPointerControls, } from "./pointer-controls.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avis-studio/mini-app",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Build AVIS mini apps as property controls: declare what can be set, run it on the AVIS API with your key; the form is drawn for you.",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
"build": "node scripts/build.mjs",
|
|
34
34
|
"prepack": "npm run build",
|
|
35
35
|
"example": "vite --config example/vite.config.ts",
|
|
36
|
-
"pack:local": "npm pack --pack-destination ./release"
|
|
36
|
+
"pack:local": "npm pack --pack-destination ./release",
|
|
37
|
+
"pack:check": "node scripts/check-package.mjs"
|
|
37
38
|
},
|
|
38
39
|
"peerDependencies": {
|
|
39
40
|
"react": "^19.3.1",
|
|
@@ -55,7 +56,7 @@
|
|
|
55
56
|
],
|
|
56
57
|
"repository": {
|
|
57
58
|
"type": "git",
|
|
58
|
-
"url": "https://github.com/khangng2209/AVIS-Components",
|
|
59
|
+
"url": "git+https://github.com/khangng2209/AVIS-Components.git",
|
|
59
60
|
"directory": "packages/mini-app"
|
|
60
61
|
}
|
|
61
62
|
}
|