@nebulahome/package-sdk 0.0.0-stage → 1.0.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.
- package/CHANGELOG.md +26 -0
- package/LICENSE +21 -0
- package/README.md +141 -2
- package/dist/chunks/context.d.ts +369 -0
- package/dist/chunks/host.js +53 -0
- package/dist/chunks/json.d.ts +657 -0
- package/dist/chunks/node-build.js +20009 -0
- package/dist/chunks/props.d.ts +68 -0
- package/dist/chunks/version.js +12 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +3556 -0
- package/dist/components.d.ts +381 -0
- package/dist/components.js +210 -0
- package/dist/index.d.ts +205 -0
- package/dist/index.js +243 -0
- package/dist/server.d.ts +30 -0
- package/dist/server.js +17 -0
- package/dist/styles.css +549 -0
- package/dist/testing.d.ts +117 -0
- package/dist/testing.js +608 -0
- package/dist/ui.d.ts +320 -0
- package/dist/ui.js +180 -0
- package/dist/vite.d.ts +88 -0
- package/dist/vite.js +2 -0
- package/package.json +110 -3
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { O as OptionField, S as FormValues, T as NoFields, d as EntityTypeDefinition, lt as EntityId, x as Fields } from "./json.js";
|
|
2
|
+
//#region src/definitions/card.d.ts
|
|
3
|
+
/** The cells a card can cover: 1×1, 2×1, 2×2 and 2×3. */
|
|
4
|
+
type CardSize = 'small' | 'wide' | 'medium' | 'large';
|
|
5
|
+
/** How a card fills its frame: inside its padding, or to its edges. */
|
|
6
|
+
type CardPadding = 'default' | 'none';
|
|
7
|
+
/** A card, as declared. */
|
|
8
|
+
type CardDefinition<TId extends string = string, TSize extends CardSize = CardSize, TOptions extends Fields<OptionField> = Fields<OptionField>> = {
|
|
9
|
+
readonly kind: 'card';
|
|
10
|
+
readonly id: TId;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly description?: string;
|
|
13
|
+
/** A catalogue icon id, as everywhere in the interface. */
|
|
14
|
+
readonly icon: string;
|
|
15
|
+
/** The sizes it can be drawn at; the first is what it is added at. `['medium']` when not said. */
|
|
16
|
+
readonly sizes?: readonly TSize[];
|
|
17
|
+
readonly padding?: CardPadding;
|
|
18
|
+
/** What its inspector asks, per card on a dashboard. */
|
|
19
|
+
readonly options?: TOptions;
|
|
20
|
+
};
|
|
21
|
+
/** The sizes a card is drawn at. */
|
|
22
|
+
type SizeOf<TCard> = TCard extends CardDefinition<string, infer TSize> ? TSize : CardSize;
|
|
23
|
+
/** The values of a card's options, defaults applied. */
|
|
24
|
+
type OptionsOf<TCard> = TCard extends CardDefinition<string, CardSize, infer TOptions> ? FormValues<TOptions> : never;
|
|
25
|
+
/**
|
|
26
|
+
* Declares a card.
|
|
27
|
+
*
|
|
28
|
+
* @param card - Its id, name, icon, sizes and options.
|
|
29
|
+
* @returns The card, for `definePackage`'s `cards` and for its component's props.
|
|
30
|
+
*/
|
|
31
|
+
declare function defineCard<const TId extends string, const TSize extends CardSize = 'medium', const TOptions extends Fields<OptionField> = NoFields>(card: Omit<CardDefinition<TId, TSize, TOptions>, 'kind'>): CardDefinition<TId, TSize, TOptions>;
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/props.d.ts
|
|
34
|
+
/** A component of the package: a function of its props, or one React wrapped (`memo`). */
|
|
35
|
+
type PackageComponent<TProps> = ((props: TProps) => unknown) | {
|
|
36
|
+
readonly $$typeof: symbol;
|
|
37
|
+
};
|
|
38
|
+
/** How a component is loaded: `() => import('./card.js')`, to it or to a module that exports it. */
|
|
39
|
+
type Loader<TProps> = () => Promise<PackageComponent<TProps> | {
|
|
40
|
+
readonly default: PackageComponent<TProps>;
|
|
41
|
+
}>;
|
|
42
|
+
/** What the package's own page is given. */
|
|
43
|
+
type PageProps = {
|
|
44
|
+
readonly packageId: string;
|
|
45
|
+
};
|
|
46
|
+
/** What a card is given. */
|
|
47
|
+
type CardProps<TCard extends CardDefinition = CardDefinition> = {
|
|
48
|
+
readonly packageId: string;
|
|
49
|
+
readonly cardId: TCard['id'];
|
|
50
|
+
/** The card's declared name. */
|
|
51
|
+
readonly name: string;
|
|
52
|
+
/** What the owner titled this card, if anything. */
|
|
53
|
+
readonly title: string | null;
|
|
54
|
+
/** The size it is drawn at now. */
|
|
55
|
+
readonly size: SizeOf<TCard>;
|
|
56
|
+
/** What its inspector asked, defaults applied. */
|
|
57
|
+
readonly options: OptionsOf<TCard>;
|
|
58
|
+
/** Whether the dashboard is being edited: no interaction is expected. */
|
|
59
|
+
readonly isEditing: boolean;
|
|
60
|
+
};
|
|
61
|
+
/** What an entity view is given. */
|
|
62
|
+
type EntityViewProps<TType extends EntityTypeDefinition = EntityTypeDefinition> = {
|
|
63
|
+
readonly packageId: string;
|
|
64
|
+
readonly entityId: EntityId;
|
|
65
|
+
readonly type: TType['id'];
|
|
66
|
+
};
|
|
67
|
+
//#endregion
|
|
68
|
+
export { PageProps as a, CardSize as c, defineCard as d, PackageComponent as i, OptionsOf as l, EntityViewProps as n, CardDefinition as o, Loader as r, CardPadding as s, CardProps as t, SizeOf as u };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#endregion
|
|
2
|
+
//#region src/version.ts
|
|
3
|
+
/**
|
|
4
|
+
* The SDK's own version, read from its `package.json` when it is built.
|
|
5
|
+
*
|
|
6
|
+
* What a package records in its manifest's `sdk` range, and what the platform says it implements:
|
|
7
|
+
* the two are compared before a package is installed or started (PACKAGES_DOCS.md 11).
|
|
8
|
+
*/
|
|
9
|
+
/** The SDK's own version, `1.0.0`. */
|
|
10
|
+
const SDK_VERSION = "1.0.0";
|
|
11
|
+
//#endregion
|
|
12
|
+
export { SDK_VERSION as t };
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|