card-gate-frame 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/LICENSE +21 -0
- package/README.md +152 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +3 -0
- package/dist/core-DzM1ds_q.js +2536 -0
- package/dist/core-DzM1ds_q.js.map +1 -0
- package/dist/index-B0WElJq8.d.ts +142 -0
- package/dist/index-B0WElJq8.d.ts.map +1 -0
- package/dist/index.d.ts +143 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +728 -0
- package/dist/index.js.map +1 -0
- package/package.json +79 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { _ as GatePaintOptions, a as GateFamily, b as GateSeed, d as GateGeometry, h as GateGeometryV3, m as GateGeometryV2, p as GateGeometryV1, r as GateCrest, u as GateGenerationVersion } from "./index-B0WElJq8.js";
|
|
2
|
+
//#region src/dom/index.d.ts
|
|
3
|
+
interface GateOptionsV1 {
|
|
4
|
+
readonly seed?: GateSeed;
|
|
5
|
+
readonly generationVersion?: 1;
|
|
6
|
+
readonly family?: "courtyard";
|
|
7
|
+
readonly density?: number;
|
|
8
|
+
readonly curvature?: number;
|
|
9
|
+
readonly symmetry?: never;
|
|
10
|
+
readonly peakHeight?: never;
|
|
11
|
+
readonly sideComplexity?: never;
|
|
12
|
+
readonly crest?: never;
|
|
13
|
+
readonly stroke?: string;
|
|
14
|
+
readonly surface?: string;
|
|
15
|
+
readonly responsive?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface GateOptionsV2 {
|
|
18
|
+
readonly seed?: GateSeed;
|
|
19
|
+
readonly generationVersion: 2;
|
|
20
|
+
readonly family?: GateFamily | "auto";
|
|
21
|
+
readonly density?: number;
|
|
22
|
+
readonly curvature?: number;
|
|
23
|
+
readonly symmetry?: number;
|
|
24
|
+
readonly peakHeight?: number;
|
|
25
|
+
readonly sideComplexity?: number;
|
|
26
|
+
readonly crest?: GateCrest;
|
|
27
|
+
readonly stroke?: string;
|
|
28
|
+
readonly surface?: string;
|
|
29
|
+
readonly responsive?: boolean;
|
|
30
|
+
}
|
|
31
|
+
interface GateOptionsV3 extends Omit<GateOptionsV2, "generationVersion"> {
|
|
32
|
+
readonly generationVersion: 3;
|
|
33
|
+
}
|
|
34
|
+
type GateOptions = GateOptionsV1 | GateOptionsV2 | GateOptionsV3;
|
|
35
|
+
type GateOptionUpdate = Partial<GateOptionsV1> | (Partial<Omit<GateOptionsV2, "generationVersion">> & {
|
|
36
|
+
readonly generationVersion?: 2;
|
|
37
|
+
}) | (Partial<Omit<GateOptionsV3, "generationVersion">> & {
|
|
38
|
+
readonly generationVersion?: 3;
|
|
39
|
+
});
|
|
40
|
+
interface GateSnapshotBase {
|
|
41
|
+
readonly seed: GateSeed;
|
|
42
|
+
readonly paint: Readonly<Required<GatePaintOptions>>;
|
|
43
|
+
}
|
|
44
|
+
interface GateSnapshotV1 extends GateSnapshotBase {
|
|
45
|
+
readonly generationVersion: 1;
|
|
46
|
+
readonly geometry: Readonly<GateGeometryV1>;
|
|
47
|
+
}
|
|
48
|
+
interface GateSnapshotV2 extends GateSnapshotBase {
|
|
49
|
+
readonly generationVersion: 2;
|
|
50
|
+
readonly geometry: Readonly<GateGeometryV2>;
|
|
51
|
+
}
|
|
52
|
+
interface GateSnapshotV3 extends GateSnapshotBase {
|
|
53
|
+
readonly generationVersion: 3;
|
|
54
|
+
readonly geometry: Readonly<GateGeometryV3>;
|
|
55
|
+
}
|
|
56
|
+
type GateSnapshot = GateSnapshotV1 | GateSnapshotV2 | GateSnapshotV3;
|
|
57
|
+
type GateFrameErrorCode = "INVALID_SELECTOR" | "TARGET_NOT_FOUND" | "TARGET_NOT_HTML_ELEMENT" | "UNSUPPORTED_TARGET" | "POSITIONING_CONFLICT" | "ALREADY_MOUNTED" | "INVALID_OPTIONS" | "UNSUPPORTED_DIMENSIONS" | "INSUFFICIENT_CONTENT_SPACE" | "NOT_READY" | "DESTROYED";
|
|
58
|
+
export declare class GateFrameError extends Error {
|
|
59
|
+
readonly code: GateFrameErrorCode;
|
|
60
|
+
readonly context: Readonly<Record<string, unknown>>;
|
|
61
|
+
constructor(code: GateFrameErrorCode, message: string, context?: Record<string, unknown>, name?: string);
|
|
62
|
+
}
|
|
63
|
+
export declare class GateFrameInvalidSelectorError extends GateFrameError {
|
|
64
|
+
constructor(selector: string);
|
|
65
|
+
}
|
|
66
|
+
export declare class GateFrameTargetNotFoundError extends GateFrameError {
|
|
67
|
+
constructor(selector: string);
|
|
68
|
+
}
|
|
69
|
+
export declare class GateFrameTargetNotHTMLElementError extends GateFrameError {
|
|
70
|
+
constructor(context: {
|
|
71
|
+
readonly source: "selector";
|
|
72
|
+
readonly selector: string;
|
|
73
|
+
readonly tagName: string;
|
|
74
|
+
} | {
|
|
75
|
+
readonly source: "direct";
|
|
76
|
+
readonly tagName: string;
|
|
77
|
+
} | {
|
|
78
|
+
readonly source: "direct";
|
|
79
|
+
readonly valueType: string;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
export declare class GateFrameAlreadyMountedError extends GateFrameError {
|
|
83
|
+
constructor(target: HTMLElement);
|
|
84
|
+
}
|
|
85
|
+
type UnsupportedTargetReason = "replaced-element" | "restricted-form-control" | "table-internal" | "display-inline" | "display-contents" | "unsupported-display" | "content-model" | "writing-mode" | "fragmented" | "shadow-host";
|
|
86
|
+
export declare class GateFrameUnsupportedTargetError extends GateFrameError {
|
|
87
|
+
constructor(target: HTMLElement, reason: UnsupportedTargetReason, details?: Record<string, unknown>);
|
|
88
|
+
}
|
|
89
|
+
export declare class GateFramePositioningConflictError extends GateFrameError {
|
|
90
|
+
constructor(target: HTMLElement, descendant: Element);
|
|
91
|
+
}
|
|
92
|
+
export declare class GateFrameInvalidOptionsError extends GateFrameError {
|
|
93
|
+
constructor(context: {
|
|
94
|
+
readonly optionKeys: ReadonlyArray<string>;
|
|
95
|
+
readonly reason: string;
|
|
96
|
+
readonly category?: "shape" | "unknown-key" | "responsive" | "version" | "family" | "seed" | "value" | "crest" | "paint";
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
export declare class GateFrameUnsupportedDimensionsError extends GateFrameError {
|
|
100
|
+
constructor(dimensions: Readonly<{
|
|
101
|
+
width: number;
|
|
102
|
+
height: number;
|
|
103
|
+
}>);
|
|
104
|
+
}
|
|
105
|
+
interface PhysicalInsets {
|
|
106
|
+
readonly top: number;
|
|
107
|
+
readonly right: number;
|
|
108
|
+
readonly bottom: number;
|
|
109
|
+
readonly left: number;
|
|
110
|
+
}
|
|
111
|
+
export declare class GateFrameInsufficientSpaceError extends GateFrameError {
|
|
112
|
+
constructor(measured: PhysicalInsets, required: PhysicalInsets);
|
|
113
|
+
}
|
|
114
|
+
export declare class GateFrameNotReadyError extends GateFrameError {
|
|
115
|
+
constructor();
|
|
116
|
+
}
|
|
117
|
+
export declare class GateFrameDestroyedError extends GateFrameError {
|
|
118
|
+
constructor();
|
|
119
|
+
}
|
|
120
|
+
type GateFrameStatus = Readonly<{
|
|
121
|
+
state: "pending";
|
|
122
|
+
}> | Readonly<{
|
|
123
|
+
state: "ready";
|
|
124
|
+
snapshot: Readonly<GateSnapshot>;
|
|
125
|
+
}> | Readonly<{
|
|
126
|
+
state: "error";
|
|
127
|
+
error: GateFrameError;
|
|
128
|
+
}> | Readonly<{
|
|
129
|
+
state: "destroyed";
|
|
130
|
+
}>;
|
|
131
|
+
interface GateFrameController {
|
|
132
|
+
status(): GateFrameStatus;
|
|
133
|
+
whenReady(): Promise<Readonly<GateSnapshot>>;
|
|
134
|
+
update(options: GateOptionUpdate): GateFrameController;
|
|
135
|
+
randomize(seed?: GateSeed): GateSeed;
|
|
136
|
+
snapshot(): Readonly<GateSnapshot> | null;
|
|
137
|
+
toSVG(): string;
|
|
138
|
+
destroy(): void;
|
|
139
|
+
}
|
|
140
|
+
export declare function gateFrame(targetValue: HTMLElement | string, options?: GateOptions): GateFrameController;
|
|
141
|
+
//#endregion
|
|
142
|
+
export type { GateCrest, GateFamily, GateFrameController, GateFrameErrorCode, GateFrameStatus, GateGenerationVersion, GateGeometry, GateGeometryV1, GateGeometryV2, GateGeometryV3, GateOptionUpdate, GateOptions, GateOptionsV1, GateOptionsV2, GateOptionsV3, GatePaintOptions, GateSeed, GateSnapshot, GateSnapshotBase, GateSnapshotV1, GateSnapshotV2, GateSnapshotV3 };
|
|
143
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/dom/index.ts"],"mappings":";;UA4BiB;WACN,OAAO;WACP;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;UAGM;WACN,OAAO;WACP;WACA,SAAS;WACT;WACA;WACA;WACA;WACA;WACA,QAAQ;WACR;WACA;WACA;;UAGM,sBAAsB,KAAK;WACjC;;KAGC,cAAc,gBAAgB,gBAAgB;KAE9C,mBACR,QAAQ,kBACP,QAAQ,KAAK;WACH;MAEV,QAAQ,KAAK;WAAkD;;UAEnD;WACN,MAAM;WACN,OAAO,SAAS,SAAS;;UAGnB,uBAAuB;WAC7B;WACA,UAAU,SAAS;;UAGb,uBAAuB;WAC7B;WACA,UAAU,SAAS;;UAGb,uBAAuB;WAC7B;WACA,UAAU,SAAS;;KAGlB,eAAe,iBAAiB,iBAAiB;KAEjD;qBAwBC,uBAAuB;WACjB,MAAM;WACN,SAAS,SAAS;EAEnC,YACE,MAAM,oBACN,iBACA,UAAS,yBACT;;qBAWS,sCAAsC;EACjD,YAAY;;qBAUD,qCAAqC;EAChD,YAAY;;qBAUD,2CAA2C;EACtD,YACE;aAEe;aACA;aACA;;aAEA;aAA2B;;aAC3B;aAA2B;;;qBAWjC,qCAAqC;EAChD,YAAY,QAAQ;;KAUjB;qBAYQ,wCAAwC;EACnD,YACE,QAAQ,aACR,QAAQ,yBACR,UAAS;;qBAWA,0CAA0C;EACrD,YAAY,QAAQ,aAAa,YAAY;;qBAUlC,qCAAqC;EAChD,YAAY;aACD,YAAY;aACZ;aACA;;;qBA0BA,4CAA4C;EACvD,YAAY,YAAY;IAAW;IAAe;;;UAU1C;WACC;WACA;WACA;WACA;;qBAGE,wCAAwC;EACnD,YAAY,UAAU,gBAAgB,UAAU;;qBAUrC,+BAA+B;EAC1C;;qBAKW,gCAAgC;EAC3C;;KAKU,kBACR;EAAW;KACX;EAAW;EAAgB,UAAU,SAAS;KAC9C;EAAW;EAAgB,OAAO;KAClC;EAAW;;UAEE;EACf,UAAU;EACV,aAAa,QAAQ,SAAS;EAC9B,OAAO,SAAS,mBAAmB;EACnC,UAAU,OAAO,WAAW;EAC5B,YAAY,SAAS;EACrB;EACA;;wBAoiBc,UACd,aAAa,sBACb,UAAS,cACR"}
|