@hy-bricks/core 0.1.1
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 +422 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +251 -0
- package/dist/index.mjs +1 -0
- package/package.json +65 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { ComponentOptions } from 'vue';
|
|
2
|
+
import { ComponentOptionsMixin } from 'vue';
|
|
3
|
+
import { ComponentProvideOptions } from 'vue';
|
|
4
|
+
import { ComponentPublicInstance } from 'vue';
|
|
5
|
+
import { DefineComponent } from 'vue';
|
|
6
|
+
import { Plugin as Plugin_2 } from 'vue';
|
|
7
|
+
import { PublicProps } from 'vue';
|
|
8
|
+
import { Ref } from 'vue';
|
|
9
|
+
|
|
10
|
+
declare const __VLS_component: DefineComponent<__VLS_Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_2> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
|
|
12
|
+
declare type __VLS_Props = {
|
|
13
|
+
instanceId: string;
|
|
14
|
+
componentId: string;
|
|
15
|
+
scopeId?: string;
|
|
16
|
+
canvasId?: string;
|
|
17
|
+
htmlSource: string;
|
|
18
|
+
jsSource: string;
|
|
19
|
+
cssSource?: string;
|
|
20
|
+
customValues?: Record<string, unknown>;
|
|
21
|
+
position?: {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
};
|
|
25
|
+
size?: {
|
|
26
|
+
w: number;
|
|
27
|
+
h: number;
|
|
28
|
+
};
|
|
29
|
+
zIndex?: number;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
declare type __VLS_Props_2 = {
|
|
33
|
+
label?: string;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
declare function __VLS_template(): {
|
|
37
|
+
attrs: Partial<{}>;
|
|
38
|
+
slots: {
|
|
39
|
+
default?(_: {}): any;
|
|
40
|
+
};
|
|
41
|
+
refs: {};
|
|
42
|
+
rootEl: any;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
declare type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
46
|
+
|
|
47
|
+
declare type __VLS_WithTemplateSlots<T, S> = T & {
|
|
48
|
+
new (): {
|
|
49
|
+
$slots: S;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export declare const assets: {
|
|
54
|
+
pickerUrl(id: string): string;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export declare function attachScope(scopeId: string, rawCss: string | undefined | null): void;
|
|
58
|
+
|
|
59
|
+
export declare interface CanvasesRegistryAPI {
|
|
60
|
+
list(): CanvasRuntimeHandle[];
|
|
61
|
+
get(canvasId: string): CanvasRuntimeHandle | null;
|
|
62
|
+
getAll(): Record<string, CanvasRuntimeHandle>;
|
|
63
|
+
callComponent<T = unknown>(canvasId: string, instanceId: string, method: string, ...args: unknown[]): T | undefined;
|
|
64
|
+
emitToCanvas(canvasId: string, instanceId: string, event: string, payload?: unknown): void;
|
|
65
|
+
broadcast(event: string, payload?: unknown): void;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export declare interface CanvasRuntimeHandle {
|
|
69
|
+
readonly canvasId: string;
|
|
70
|
+
listInstances(filter?: {
|
|
71
|
+
componentId?: string;
|
|
72
|
+
}): ComponentInstanceHandle[];
|
|
73
|
+
getInstance(instanceId: string): ComponentInstanceHandle | null;
|
|
74
|
+
call<T = unknown>(instanceId: string, method: string, ...args: unknown[]): T | undefined;
|
|
75
|
+
emit(instanceId: string, event: string, payload?: unknown): void;
|
|
76
|
+
broadcastInCanvas(event: string, payload?: unknown): void;
|
|
77
|
+
dispose(): void;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export declare function clearCompileCache(): void;
|
|
81
|
+
|
|
82
|
+
export declare function compileComponent(source: ComponentSource): Promise<CompiledComponent>;
|
|
83
|
+
|
|
84
|
+
export declare interface CompiledComponent {
|
|
85
|
+
options: ComponentOptions;
|
|
86
|
+
meta: ComponentMeta;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export declare interface ComponentInstanceHandle {
|
|
90
|
+
readonly instanceId: string;
|
|
91
|
+
readonly componentId: string;
|
|
92
|
+
readonly vm: ComponentPublicInstance;
|
|
93
|
+
call<T = unknown>(method: string, ...args: unknown[]): T;
|
|
94
|
+
on(event: string, handler: (payload: unknown) => void): () => void;
|
|
95
|
+
emit(event: string, payload?: unknown): void;
|
|
96
|
+
setProp(key: string, value: unknown): void;
|
|
97
|
+
setDataInput(key: string, value: unknown): void;
|
|
98
|
+
__dispose(): void;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export declare interface ComponentMeta {
|
|
102
|
+
name?: {
|
|
103
|
+
value?: string;
|
|
104
|
+
CN?: string;
|
|
105
|
+
};
|
|
106
|
+
attribute: Record<string, string>;
|
|
107
|
+
style: Record<string, string>;
|
|
108
|
+
customDecl: Record<string, CustomDecl>;
|
|
109
|
+
methodNames: string[];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export declare interface ComponentSource {
|
|
113
|
+
html: string;
|
|
114
|
+
js: string;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export declare function createCanvasesRegistry(): CanvasesRegistryAPI;
|
|
118
|
+
|
|
119
|
+
export declare function createHyperCard(config?: HyperCardConfig): Plugin_2;
|
|
120
|
+
|
|
121
|
+
export declare interface CustomDecl {
|
|
122
|
+
value?: unknown;
|
|
123
|
+
type?: 'string' | 'number' | 'boolean' | 'object' | 'array' | 'any';
|
|
124
|
+
name?: string;
|
|
125
|
+
enum?: unknown[];
|
|
126
|
+
description?: string;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export declare function debugScopedCssRefs(): Array<{
|
|
130
|
+
scopeId: string;
|
|
131
|
+
componentId: string;
|
|
132
|
+
refCount: number;
|
|
133
|
+
cssHash: string;
|
|
134
|
+
}>;
|
|
135
|
+
|
|
136
|
+
export declare const DEFAULT_CANVAS_ID = "__default__";
|
|
137
|
+
|
|
138
|
+
export declare function detachScope(scopeId: string): void;
|
|
139
|
+
|
|
140
|
+
export declare function disposeCanvas(canvasId: string): void;
|
|
141
|
+
|
|
142
|
+
export declare interface EmitDecl {
|
|
143
|
+
event: string;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export declare const ErrorBoundary: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
147
|
+
|
|
148
|
+
export declare function getCompileCacheSize(): number;
|
|
149
|
+
|
|
150
|
+
export declare function getInstance(instanceId: string, canvasId?: string): ComponentInstanceHandle | null;
|
|
151
|
+
|
|
152
|
+
export declare function getScopedCssCount(): number;
|
|
153
|
+
|
|
154
|
+
export declare const HC_CANVAS_ID_KEY = "__hcCanvasId";
|
|
155
|
+
|
|
156
|
+
export declare const HC_INJECT_KEY = "__HYPERCARD__";
|
|
157
|
+
|
|
158
|
+
export declare interface HyperCardConfig {
|
|
159
|
+
libs?: LibsConfig;
|
|
160
|
+
strict?: boolean;
|
|
161
|
+
version?: string;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export declare interface HyperCardInstance {
|
|
165
|
+
libs: LibsRegistry & Record<string, unknown>;
|
|
166
|
+
runtime: RuntimeAPI;
|
|
167
|
+
assets: typeof assets;
|
|
168
|
+
version: string;
|
|
169
|
+
canvases: CanvasesRegistryAPI;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export declare function injectScopedCss(scopeId: string, rawCss: string | undefined | null): void;
|
|
173
|
+
|
|
174
|
+
export declare function isVuePlugin(v: unknown): boolean;
|
|
175
|
+
|
|
176
|
+
declare type LibConfigValue<T> = T | readonly [T, ...unknown[]];
|
|
177
|
+
|
|
178
|
+
declare type LibsConfig = {
|
|
179
|
+
[K in keyof LibsRegistry]?: LibConfigValue<LibsRegistry[K]>;
|
|
180
|
+
} & Record<string, unknown>;
|
|
181
|
+
|
|
182
|
+
export declare interface LibsRegistry {
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export declare function listCanvasIds(): string[];
|
|
186
|
+
|
|
187
|
+
export declare function listInstances(opts?: {
|
|
188
|
+
canvasId?: string;
|
|
189
|
+
componentId?: string;
|
|
190
|
+
}): ComponentInstanceHandle[];
|
|
191
|
+
|
|
192
|
+
export declare interface MethodDecl {
|
|
193
|
+
name: string;
|
|
194
|
+
params: string[];
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export declare function parseComponentSource(jsSource: unknown): ParsedSource;
|
|
198
|
+
|
|
199
|
+
export declare interface ParsedSource {
|
|
200
|
+
methodsDecl: MethodDecl[];
|
|
201
|
+
emitsDecl: EmitDecl[];
|
|
202
|
+
propsDecl: PropDecl[];
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export declare interface PropDecl {
|
|
206
|
+
key: string;
|
|
207
|
+
value?: unknown;
|
|
208
|
+
type?: string;
|
|
209
|
+
name?: string;
|
|
210
|
+
enum?: unknown[];
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export declare function register(instanceId: string, componentId: string, vm: ComponentPublicInstance): ComponentInstanceHandle;
|
|
214
|
+
|
|
215
|
+
export declare function registerInCanvas(canvasId: string, instanceId: string, componentId: string, vm: ComponentPublicInstance): ComponentInstanceHandle;
|
|
216
|
+
|
|
217
|
+
export declare const registryVersion: Ref<number, number>;
|
|
218
|
+
|
|
219
|
+
export declare function removeScopedCss(scopeId: string): void;
|
|
220
|
+
|
|
221
|
+
export declare const runtime: RuntimeAPI;
|
|
222
|
+
|
|
223
|
+
export declare interface RuntimeAPI {
|
|
224
|
+
getInstance(id: string): ComponentInstanceHandle | null;
|
|
225
|
+
listInstances(filter?: {
|
|
226
|
+
componentId?: string;
|
|
227
|
+
}): ComponentInstanceHandle[];
|
|
228
|
+
call<T = unknown>(id: string, method: string, ...args: unknown[]): T | undefined;
|
|
229
|
+
on(id: string, event: string, handler: (payload: unknown) => void): (() => void) | undefined;
|
|
230
|
+
emit(id: string, event: string, payload?: unknown): void;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export declare const RuntimeBox: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
234
|
+
cssSource: string;
|
|
235
|
+
customValues: Record<string, unknown>;
|
|
236
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
237
|
+
|
|
238
|
+
export declare function scopeCss(rawCss: string, scopeId: string): string;
|
|
239
|
+
|
|
240
|
+
export declare function unregister(instanceId: string, canvasId?: string): void;
|
|
241
|
+
|
|
242
|
+
export declare const VERSION = "0.0.0-stage2b";
|
|
243
|
+
|
|
244
|
+
export { }
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
declare module 'vue' {
|
|
248
|
+
interface ComponentCustomProperties {
|
|
249
|
+
$hc: HyperCardInstance;
|
|
250
|
+
}
|
|
251
|
+
}
|