@myop/vue 0.0.25 → 0.0.26
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 +288 -111
- package/dist/components/MyopComponent.vue.d.ts +27 -0
- package/dist/components/MyopFallback.vue.d.ts +12 -0
- package/dist/components/MyopLoader.vue.d.ts +19 -0
- package/dist/index.d.ts +44 -1
- package/dist/index.js +633 -1990
- package/dist/index.umd.cjs +11 -110
- package/dist/types.d.ts +75 -0
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -24,6 +24,81 @@ yarn add @myop/vue
|
|
|
24
24
|
pnpm add @myop/vue
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
+
## Auto-Generated Vue Components
|
|
28
|
+
|
|
29
|
+
Myop automatically generates a typed Vue component package for every component you create in the [dashboard](https://dashboard.myop.dev/). Install it directly via npm:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install https://cloud.myop.dev/npm/{component-id}/vue
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Then import and use it like any Vue component. For example, if you created a table component called "users-table" in the dashboard:
|
|
36
|
+
|
|
37
|
+
```vue
|
|
38
|
+
<script setup lang="ts">
|
|
39
|
+
import { UsersTable } from "@myop/users-table";
|
|
40
|
+
|
|
41
|
+
const users = [
|
|
42
|
+
{ id: 1, name: "Alice", email: "alice@example.com", role: "Admin" },
|
|
43
|
+
{ id: 2, name: "Bob", email: "bob@example.com", role: "User" },
|
|
44
|
+
{ id: 3, name: "Charlie", email: "charlie@example.com", role: "User" },
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
function handleRowClicked(payload: { rowData: any }) {
|
|
48
|
+
console.log("Selected user:", payload.rowData);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function handleDeleteClicked(payload: { userId: number }) {
|
|
52
|
+
deleteUser(payload.userId);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function handleExportRequested(payload: { format: "csv" | "xlsx" }) {
|
|
56
|
+
exportToFormat(payload.format);
|
|
57
|
+
}
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<template>
|
|
61
|
+
<UsersTable
|
|
62
|
+
:data="{ rows: users }"
|
|
63
|
+
@row-clicked="handleRowClicked"
|
|
64
|
+
@delete-clicked="handleDeleteClicked"
|
|
65
|
+
@export-requested="handleExportRequested"
|
|
66
|
+
/>
|
|
67
|
+
</template>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Why this is powerful:**
|
|
71
|
+
|
|
72
|
+
- **Fully typed** — The generated package includes complete TypeScript types for your component's data interface and all CTA event payloads
|
|
73
|
+
- **Auto loaded** — Components are fetched and rendered automatically, no manual setup required
|
|
74
|
+
- **Not in your code** — The actual component implementation lives on Myop and is loaded at runtime. Update your component in the dashboard and it's instantly live—no rebuild, no redeploy
|
|
75
|
+
- **Zero bundle impact** — The entire `@myop/vue` package costs only ~6KB gzipped—and that's the total cost whether you use 1, 2, or 1,000 components. Auto-generated component packages are just thin typed wrappers. The actual component implementations are loaded at runtime, meaning your Myop components can be as complex, feature-rich, and heavy as you need without adding a single byte to your application bundle. Consider typical bundle costs: a chart library (~60KB), a map component (~200KB), a data grid (~150KB), a rich text editor (~100KB), or a chat widget with emoji picker (~80KB). With Myop, all of these cost ~0KB to your bundle—they load on-demand when needed
|
|
76
|
+
|
|
77
|
+
**Environment options:**
|
|
78
|
+
|
|
79
|
+
Set the default environment for all components using `setEnvironment`:
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
import { setEnvironment } from "@myop/vue";
|
|
83
|
+
|
|
84
|
+
// Set default environment for all component loads
|
|
85
|
+
setEnvironment("staging");
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
You can also override the environment directly on a specific component:
|
|
89
|
+
|
|
90
|
+
```vue
|
|
91
|
+
<template>
|
|
92
|
+
<UsersTable
|
|
93
|
+
:data="{ rows: users }"
|
|
94
|
+
:preview="true"
|
|
95
|
+
environment="staging"
|
|
96
|
+
/>
|
|
97
|
+
</template>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Environments are fully configurable in the [dashboard](https://dashboard.myop.dev/), allowing you to test changes in staging before publishing to production.
|
|
101
|
+
|
|
27
102
|
## Requirements
|
|
28
103
|
|
|
29
104
|
- Vue 3.0+
|
|
@@ -32,57 +107,55 @@ pnpm add @myop/vue
|
|
|
32
107
|
|
|
33
108
|
```vue
|
|
34
109
|
<script setup lang="ts">
|
|
35
|
-
import {
|
|
110
|
+
import { MyopComponent } from "@myop/vue";
|
|
36
111
|
|
|
37
|
-
function
|
|
38
|
-
console.log("
|
|
112
|
+
function handleAction(action: string, payload: any) {
|
|
113
|
+
console.log("Action:", action, "Payload:", payload);
|
|
39
114
|
}
|
|
40
115
|
</script>
|
|
41
116
|
|
|
42
117
|
<template>
|
|
43
|
-
<
|
|
118
|
+
<MyopComponent
|
|
44
119
|
componentId="your-component-id"
|
|
45
|
-
:onReady="handleReady"
|
|
46
120
|
:style="{ width: '600px', height: '400px' }"
|
|
121
|
+
@action="handleAction"
|
|
47
122
|
/>
|
|
48
123
|
</template>
|
|
49
124
|
```
|
|
50
125
|
|
|
51
126
|
## Components
|
|
52
127
|
|
|
53
|
-
### `
|
|
128
|
+
### `MyopComponent`
|
|
54
129
|
|
|
55
|
-
The main component for embedding Myop components
|
|
130
|
+
The main component for embedding Myop components.
|
|
56
131
|
|
|
57
132
|
```vue
|
|
58
133
|
<script setup lang="ts">
|
|
59
|
-
import {
|
|
60
|
-
import type { IMyopComponent } from "@myop/sdk/host";
|
|
134
|
+
import { MyopComponent } from "@myop/vue";
|
|
61
135
|
|
|
62
|
-
const items = [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
136
|
+
const items = [{ id: 1, name: "Item 1" }, { id: 2, name: "Item 2" }];
|
|
137
|
+
|
|
138
|
+
function handleRowClicked(payload: any) {
|
|
139
|
+
console.log("Row clicked:", payload);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function handleLoad(component: any) {
|
|
143
|
+
console.log("Loaded!", component);
|
|
144
|
+
}
|
|
66
145
|
|
|
67
|
-
function
|
|
68
|
-
console.
|
|
69
|
-
// Access inner Vue component if the Myop component is Vue-based
|
|
70
|
-
if (innerVueComponentRef) {
|
|
71
|
-
console.log("Inner Vue component:", innerVueComponentRef);
|
|
72
|
-
}
|
|
146
|
+
function handleError(error: string) {
|
|
147
|
+
console.error("Error:", error);
|
|
73
148
|
}
|
|
74
149
|
</script>
|
|
75
150
|
|
|
76
151
|
<template>
|
|
77
|
-
<
|
|
152
|
+
<MyopComponent
|
|
78
153
|
componentId="abc123"
|
|
79
|
-
:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
</template>
|
|
85
|
-
</MyopContainer>
|
|
154
|
+
:data="{ items }"
|
|
155
|
+
@row-clicked="handleRowClicked"
|
|
156
|
+
@load="handleLoad"
|
|
157
|
+
@error="handleError"
|
|
158
|
+
/>
|
|
86
159
|
</template>
|
|
87
160
|
```
|
|
88
161
|
|
|
@@ -90,132 +163,235 @@ function handleReady(component: IMyopComponent, innerVueComponentRef?: any) {
|
|
|
90
163
|
|
|
91
164
|
| Prop | Type | Description |
|
|
92
165
|
|------|------|-------------|
|
|
93
|
-
| `componentId` | `string` |
|
|
94
|
-
| `
|
|
95
|
-
| `
|
|
166
|
+
| `componentId` | `string` | The ID of the Myop component to load |
|
|
167
|
+
| `data` | `object` | Data to pass to the component via `myop_init_interface` |
|
|
168
|
+
| `style` | `object` | CSS styles for the container |
|
|
169
|
+
| `#loader` | `slot` | Loading indicator slot (default: no loader). Use `<MyopLoader />` for default Myop loader |
|
|
170
|
+
| `#fallback` | `slot` | Error fallback slot (default: `<MyopFallback />`). Override with custom component |
|
|
171
|
+
| `fadeDuration` | `number` | Loader fade-out duration in ms (default: `200`) |
|
|
172
|
+
| `environment` | `string` | Load from a specific environment (e.g., `"staging"`, `"prod"`) |
|
|
173
|
+
| `preview` | `boolean` | Load the unpublished preview version of the component |
|
|
174
|
+
|
|
175
|
+
#### Events
|
|
96
176
|
|
|
97
|
-
|
|
177
|
+
| Event | Payload | Description |
|
|
178
|
+
|-------|---------|-------------|
|
|
179
|
+
| `@action` | `(action, payload)` | Generic handler for all CTA events |
|
|
180
|
+
| `@[action-name]` | `payload` | Handler for specific actions (e.g., `@row-clicked`) |
|
|
181
|
+
| `@load` | `component` | Called when the component finishes loading |
|
|
182
|
+
| `@error` | `error: string` | Called when loading fails |
|
|
98
183
|
|
|
99
|
-
|
|
184
|
+
#### Environments & Preview
|
|
185
|
+
|
|
186
|
+
Myop supports multiple environments, allowing you to test changes before going live:
|
|
100
187
|
|
|
101
188
|
```vue
|
|
102
189
|
<template>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
:rows="tableData"
|
|
106
|
-
:columns="columnConfig"
|
|
107
|
-
:sortable="true"
|
|
108
|
-
title="Users Table"
|
|
109
|
-
/>
|
|
110
|
-
</template>
|
|
111
|
-
```
|
|
190
|
+
<!-- Production (default) -->
|
|
191
|
+
<MyopComponent componentId="abc123" />
|
|
112
192
|
|
|
113
|
-
|
|
193
|
+
<!-- Load from staging environment -->
|
|
194
|
+
<MyopComponent componentId="abc123" environment="staging" />
|
|
114
195
|
|
|
115
|
-
|
|
196
|
+
<!-- Load unpublished preview version (for testing before publishing) -->
|
|
197
|
+
<MyopComponent componentId="abc123" :preview="true" />
|
|
116
198
|
|
|
117
|
-
|
|
118
|
-
<
|
|
119
|
-
<MyopContainer componentId="my-component">
|
|
120
|
-
<template #loading>
|
|
121
|
-
<div class="custom-loader">
|
|
122
|
-
<span>Loading component...</span>
|
|
123
|
-
</div>
|
|
124
|
-
</template>
|
|
125
|
-
</MyopContainer>
|
|
199
|
+
<!-- Combine both: preview version in staging -->
|
|
200
|
+
<MyopComponent componentId="abc123" environment="staging" :preview="true" />
|
|
126
201
|
</template>
|
|
127
202
|
```
|
|
128
203
|
|
|
129
|
-
|
|
204
|
+
Environments are configured in the [dashboard](https://dashboard.myop.dev/). Use `:preview="true"` to test unpublished changes before making them live.
|
|
130
205
|
|
|
131
|
-
|
|
206
|
+
### `MyopContainer` (Legacy)
|
|
132
207
|
|
|
133
|
-
|
|
134
|
-
- **Expose access**: Access the inner component's exposed properties and methods via the `innerVueComponentRef` parameter in `onReady`
|
|
208
|
+
The legacy container component. Use `MyopComponent` for new projects.
|
|
135
209
|
|
|
136
210
|
```vue
|
|
137
211
|
<script setup lang="ts">
|
|
138
|
-
import { ref } from "vue";
|
|
139
212
|
import { MyopContainer } from "@myop/vue";
|
|
140
213
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
function handleReady(component, innerVueRef) {
|
|
144
|
-
// Call methods exposed by the inner Vue component
|
|
145
|
-
if (innerVueRef?.someMethod) {
|
|
146
|
-
innerVueRef.someMethod();
|
|
147
|
-
}
|
|
214
|
+
function handleReady(component: any) {
|
|
215
|
+
console.log("Ready!", component);
|
|
148
216
|
}
|
|
149
217
|
</script>
|
|
150
218
|
|
|
151
219
|
<template>
|
|
152
220
|
<MyopContainer
|
|
153
|
-
|
|
154
|
-
componentId="vue-component"
|
|
221
|
+
componentId="abc123"
|
|
155
222
|
:onReady="handleReady"
|
|
156
223
|
/>
|
|
157
224
|
</template>
|
|
158
225
|
```
|
|
159
226
|
|
|
160
|
-
##
|
|
227
|
+
## Type-Safe Event Handlers
|
|
161
228
|
|
|
162
|
-
|
|
229
|
+
Define your CTA payloads for fully typed event handlers:
|
|
163
230
|
|
|
164
231
|
```vue
|
|
165
232
|
<script setup lang="ts">
|
|
166
|
-
import {
|
|
233
|
+
import { MyopComponent } from "@myop/vue";
|
|
234
|
+
|
|
235
|
+
// Define your component's data and CTA payload types
|
|
236
|
+
interface MyData {
|
|
237
|
+
items: { id: string; name: string }[];
|
|
238
|
+
}
|
|
167
239
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
});
|
|
240
|
+
interface RowClickedPayload {
|
|
241
|
+
rowIndex: number;
|
|
242
|
+
rowData: any;
|
|
243
|
+
}
|
|
173
244
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
245
|
+
interface ItemSelectedPayload {
|
|
246
|
+
itemId: string;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
interface ExportRequestedPayload {
|
|
250
|
+
format: "csv" | "json";
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function handleRowClicked(payload: RowClickedPayload) {
|
|
254
|
+
console.log("Row clicked:", payload.rowIndex);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function handleItemSelected(payload: ItemSelectedPayload) {
|
|
258
|
+
console.log("Item selected:", payload.itemId);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function handleAction(action: string, payload: any) {
|
|
262
|
+
console.log(action, payload);
|
|
177
263
|
}
|
|
178
264
|
</script>
|
|
179
265
|
|
|
180
266
|
<template>
|
|
181
|
-
<
|
|
182
|
-
componentId="
|
|
183
|
-
:
|
|
267
|
+
<MyopComponent
|
|
268
|
+
componentId="dashboard-component"
|
|
269
|
+
:data="{ items: [...] }"
|
|
270
|
+
@row-clicked="handleRowClicked"
|
|
271
|
+
@item-selected="handleItemSelected"
|
|
272
|
+
@action="handleAction"
|
|
184
273
|
/>
|
|
185
274
|
</template>
|
|
186
275
|
```
|
|
187
276
|
|
|
188
|
-
##
|
|
277
|
+
## Configuration
|
|
278
|
+
|
|
279
|
+
### Preloading Components
|
|
280
|
+
|
|
281
|
+
Preload components for faster rendering:
|
|
282
|
+
|
|
283
|
+
```ts
|
|
284
|
+
import { preloadComponents, isPreloaded } from "@myop/vue";
|
|
285
|
+
|
|
286
|
+
// Preload multiple components
|
|
287
|
+
await preloadComponents(["component-1", "component-2"]);
|
|
288
|
+
|
|
289
|
+
// Check if a component is preloaded
|
|
290
|
+
if (isPreloaded("component-1")) {
|
|
291
|
+
console.log("Component is cached and ready");
|
|
292
|
+
}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Custom Repository URL
|
|
296
|
+
|
|
297
|
+
```ts
|
|
298
|
+
import { setCloudRepositoryUrl } from "@myop/vue";
|
|
299
|
+
|
|
300
|
+
// Point to a custom Myop server
|
|
301
|
+
setCloudRepositoryUrl("https://your-custom-server.com");
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Environment Configuration
|
|
305
|
+
|
|
306
|
+
```ts
|
|
307
|
+
import { setEnvironment } from "@myop/vue";
|
|
308
|
+
|
|
309
|
+
// Set default environment for all component loads
|
|
310
|
+
setEnvironment("staging");
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Local Development
|
|
314
|
+
|
|
315
|
+
```ts
|
|
316
|
+
import { enableLocalDev } from "@myop/vue";
|
|
317
|
+
|
|
318
|
+
// Connect to local Myop development server (localhost:9292)
|
|
319
|
+
enableLocalDev();
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### Advanced: Custom Repository
|
|
323
|
+
|
|
324
|
+
```ts
|
|
325
|
+
import { setCloudRepository, getCloudRepository } from "@myop/vue";
|
|
326
|
+
import { CloudRepository } from "@myop/sdk/helpers";
|
|
327
|
+
|
|
328
|
+
// Set a custom CloudRepository instance
|
|
329
|
+
const customRepo = new CloudRepository("https://custom-url.com");
|
|
330
|
+
setCloudRepository(customRepo);
|
|
331
|
+
|
|
332
|
+
// Get the current repository
|
|
333
|
+
const repo = getCloudRepository();
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
## Loading & Error States
|
|
337
|
+
|
|
338
|
+
By default, no loader is shown while the component loads. The Myop-branded fallback is displayed automatically on error.
|
|
189
339
|
|
|
190
|
-
|
|
340
|
+
### Using the Default Myop Loader
|
|
191
341
|
|
|
192
342
|
```vue
|
|
193
343
|
<script setup lang="ts">
|
|
194
|
-
import {
|
|
195
|
-
|
|
344
|
+
import { MyopComponent, MyopLoader } from "@myop/vue";
|
|
345
|
+
</script>
|
|
196
346
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
347
|
+
<template>
|
|
348
|
+
<MyopComponent componentId="my-component" :fadeDuration="300">
|
|
349
|
+
<template #loader>
|
|
350
|
+
<MyopLoader />
|
|
351
|
+
</template>
|
|
352
|
+
</MyopComponent>
|
|
353
|
+
</template>
|
|
354
|
+
```
|
|
200
355
|
|
|
201
|
-
|
|
202
|
-
rows: [
|
|
203
|
-
{ id: 1, name: "Alice" },
|
|
204
|
-
{ id: 2, name: "Bob" },
|
|
205
|
-
],
|
|
206
|
-
};
|
|
356
|
+
### Custom Loading State
|
|
207
357
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
358
|
+
```vue
|
|
359
|
+
<template>
|
|
360
|
+
<MyopComponent componentId="my-component" :fadeDuration="300">
|
|
361
|
+
<template #loader>
|
|
362
|
+
<div class="custom-loader">
|
|
363
|
+
<Spinner />
|
|
364
|
+
<p>Loading component...</p>
|
|
365
|
+
</div>
|
|
366
|
+
</template>
|
|
367
|
+
</MyopComponent>
|
|
368
|
+
</template>
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
### Custom Error Fallback
|
|
372
|
+
|
|
373
|
+
```vue
|
|
374
|
+
<script setup lang="ts">
|
|
375
|
+
import { MyopComponent, MyopFallback } from "@myop/vue";
|
|
211
376
|
</script>
|
|
212
377
|
|
|
213
378
|
<template>
|
|
214
|
-
<
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
379
|
+
<MyopComponent componentId="my-component">
|
|
380
|
+
<!-- Custom fallback -->
|
|
381
|
+
<template #fallback>
|
|
382
|
+
<div class="error-state">
|
|
383
|
+
<p>Failed to load component</p>
|
|
384
|
+
<button @click="() => window.location.reload()">Retry</button>
|
|
385
|
+
</div>
|
|
386
|
+
</template>
|
|
387
|
+
</MyopComponent>
|
|
388
|
+
|
|
389
|
+
<!-- Or use default Myop fallback explicitly -->
|
|
390
|
+
<MyopComponent componentId="other-component">
|
|
391
|
+
<template #fallback>
|
|
392
|
+
<MyopFallback />
|
|
393
|
+
</template>
|
|
394
|
+
</MyopComponent>
|
|
219
395
|
</template>
|
|
220
396
|
```
|
|
221
397
|
|
|
@@ -225,16 +401,17 @@ function handleReady(component: IMyopComponent) {
|
|
|
225
401
|
|
|
226
402
|
| Export | Description |
|
|
227
403
|
|--------|-------------|
|
|
228
|
-
| `
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
|
233
|
-
|
|
234
|
-
| `
|
|
235
|
-
| `
|
|
236
|
-
| `
|
|
404
|
+
| `MyopComponent` | Main component for embedding Myop components |
|
|
405
|
+
| `MyopLoader` | Default Myop-branded loading indicator (opt-in) |
|
|
406
|
+
| `MyopFallback` | Default Myop-branded error fallback |
|
|
407
|
+
| `preloadComponents` | Preload components for faster rendering |
|
|
408
|
+
| `isPreloaded` | Check if a component is cached |
|
|
409
|
+
| `enableLocalDev` | Enable local development mode |
|
|
410
|
+
| `setCloudRepositoryUrl` | Set custom server URL |
|
|
411
|
+
| `setCloudRepository` | Set custom CloudRepository instance |
|
|
412
|
+
| `getCloudRepository` | Get current CloudRepository instance |
|
|
413
|
+
| `setEnvironment` | Set default environment |
|
|
237
414
|
|
|
238
415
|
## License
|
|
239
416
|
|
|
240
|
-
MIT
|
|
417
|
+
MIT
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type IMyopComponent } from "@myop/sdk/host";
|
|
2
|
+
import type { SizeInfo, ITypedMyopComponent, IBaseProps } from "../types";
|
|
3
|
+
declare const _default: <TData = any, TCtaPayloads extends Record<string, any> = Record<string, any>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
5
|
+
readonly onError?: ((error: string) => any) | undefined;
|
|
6
|
+
readonly onLoad?: ((component: ITypedMyopComponent<TData, TCtaPayloads>) => any) | undefined;
|
|
7
|
+
readonly onSizeChange?: ((size: SizeInfo) => any) | undefined;
|
|
8
|
+
readonly onCta?: ((action: string, payload: any) => any) | undefined;
|
|
9
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onLoad" | "onError" | "onSizeChange" | "onCta"> & IBaseProps<TData, TCtaPayloads> & Partial<{}>> & import("vue").PublicProps;
|
|
10
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{
|
|
11
|
+
myopComponent: import("vue").ShallowRef<IMyopComponent<any, any> | null, IMyopComponent<any, any> | null>;
|
|
12
|
+
isLoaded: import("vue").Ref<boolean, boolean>;
|
|
13
|
+
}>): void;
|
|
14
|
+
attrs: any;
|
|
15
|
+
slots: {
|
|
16
|
+
loader?: (props: {}) => any;
|
|
17
|
+
} & {
|
|
18
|
+
fallback?: (props: {}) => any;
|
|
19
|
+
};
|
|
20
|
+
emit: ((evt: "error", error: string) => void) & ((evt: "load", component: ITypedMyopComponent<TData, TCtaPayloads>) => void) & ((evt: "sizeChange", size: SizeInfo) => void) & ((evt: "cta", action: string, payload: any) => void);
|
|
21
|
+
}>) => import("vue").VNode & {
|
|
22
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
23
|
+
};
|
|
24
|
+
export default _default;
|
|
25
|
+
type __VLS_PrettifyLocal<T> = {
|
|
26
|
+
[K in keyof T]: T[K];
|
|
27
|
+
} & {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare var __VLS_1: {};
|
|
2
|
+
type __VLS_Slots = {} & {
|
|
3
|
+
default?: (props: typeof __VLS_1) => any;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
6
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
7
|
+
export default _default;
|
|
8
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
9
|
+
new (): {
|
|
10
|
+
$slots: S;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
opacity?: number;
|
|
3
|
+
fadeDuration?: number;
|
|
4
|
+
}
|
|
5
|
+
declare var __VLS_1: {};
|
|
6
|
+
type __VLS_Slots = {} & {
|
|
7
|
+
default?: (props: typeof __VLS_1) => any;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
10
|
+
opacity: number;
|
|
11
|
+
fadeDuration: number;
|
|
12
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
14
|
+
export default _default;
|
|
15
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
16
|
+
new (): {
|
|
17
|
+
$slots: S;
|
|
18
|
+
};
|
|
19
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,44 @@
|
|
|
1
|
-
export { default as
|
|
1
|
+
export { default as MyopComponent } from "./components/MyopComponent.vue";
|
|
2
|
+
export { default as MyopLoader } from "./components/MyopLoader.vue";
|
|
3
|
+
export { default as MyopFallback } from "./components/MyopFallback.vue";
|
|
4
|
+
export { default as MyopContainer } from "./components/MyopVueComponent.vue";
|
|
5
|
+
export type { IMyopComponent } from "@myop/sdk/host";
|
|
6
|
+
export type { IComponentInstanceConfig, SizeInfo, IPropTypes, KebabToPascal, EventHandlerProps, IMyopComponentProps, ITypedMyopComponent, } from "./types";
|
|
7
|
+
import { CloudRepository } from "@myop/sdk/helpers";
|
|
8
|
+
/**
|
|
9
|
+
* Get the current CloudRepository instance
|
|
10
|
+
*/
|
|
11
|
+
export declare const getCloudRepository: () => CloudRepository;
|
|
12
|
+
/**
|
|
13
|
+
* Check if a component is already preloaded/cached
|
|
14
|
+
* If env/preview not provided, checks if ANY version is preloaded
|
|
15
|
+
*/
|
|
16
|
+
export declare const isPreloaded: (componentId: string, env?: string, preview?: boolean) => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Get the preloaded params for a component
|
|
19
|
+
*/
|
|
20
|
+
export declare const getPreloadedParams: (componentId: string) => {
|
|
21
|
+
env: string;
|
|
22
|
+
preview: boolean;
|
|
23
|
+
} | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Enable local development mode
|
|
26
|
+
*/
|
|
27
|
+
export declare const enableLocalDev: () => void;
|
|
28
|
+
/**
|
|
29
|
+
* Set a custom CloudRepository URL
|
|
30
|
+
*/
|
|
31
|
+
export declare const setCloudRepositoryUrl: (url: string) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Set a custom CloudRepository instance
|
|
34
|
+
*/
|
|
35
|
+
export declare const setCloudRepository: (repository: CloudRepository) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Set the default environment for component loading
|
|
38
|
+
*/
|
|
39
|
+
export declare const setEnvironment: (env: string) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Preload components for faster rendering.
|
|
42
|
+
* Continues even if some components fail to load.
|
|
43
|
+
*/
|
|
44
|
+
export declare const preloadComponents: (ids: string[], env?: string, preview?: boolean) => Promise<PromiseSettledResult<import("@myop/sdk/common").IComponentConfig>[]>;
|