@bagelink/blox 1.5.15 → 1.5.17
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 +105 -1
- package/config/baseComponents.ts +307 -285
- package/dist/blox.css +19 -19
- package/dist/config/baseComponents.d.ts +12 -2
- package/dist/config/baseComponents.d.ts.map +1 -1
- package/dist/example-setup.d.ts +1 -0
- package/dist/example-setup.d.ts.map +1 -0
- package/dist/index.cjs +555 -366
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +548 -367
- package/dist/setup.d.ts +113 -5
- package/dist/setup.d.ts.map +1 -1
- package/dist/styles.d.ts +8 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/views/ExternalPreview.vue.d.ts.map +1 -1
- package/dist/views/RenderPage.vue.d.ts.map +1 -1
- package/index.ts +15 -5
- package/package.json +4 -2
- package/setup.ts +431 -15
- package/views/ExternalPreview.vue +7 -12
- package/views/RenderPage.vue +2 -2
package/dist/setup.d.ts
CHANGED
|
@@ -1,24 +1,132 @@
|
|
|
1
|
+
import { App } from 'vue';
|
|
2
|
+
import { Router } from 'vue-router';
|
|
1
3
|
import { ComponentConfig } from './config/baseComponents';
|
|
4
|
+
export interface BloxInstance {
|
|
5
|
+
/**
|
|
6
|
+
* Register one or more components with the Blox library
|
|
7
|
+
* Accepts either a single component config or an array of component configs
|
|
8
|
+
*/
|
|
9
|
+
registerComponents: (components: ComponentConfig | ComponentConfig[], options?: RegisterOptions) => BloxInstance;
|
|
10
|
+
/**
|
|
11
|
+
* Register routes for preview pages with your Vue Router
|
|
12
|
+
*/
|
|
13
|
+
registerRoutes: (router: Router, options?: RouteOptions) => BloxInstance;
|
|
14
|
+
/**
|
|
15
|
+
* Get all registered component configurations
|
|
16
|
+
*/
|
|
17
|
+
getRegisteredComponents: () => ComponentConfig[];
|
|
18
|
+
/**
|
|
19
|
+
* Get components by category
|
|
20
|
+
*/
|
|
21
|
+
getComponentsByCategory: (category: string) => ComponentConfig[];
|
|
22
|
+
/**
|
|
23
|
+
* Get a list of registered component IDs
|
|
24
|
+
*/
|
|
25
|
+
getComponentIds: () => string[];
|
|
26
|
+
/**
|
|
27
|
+
* Check if a component is registered
|
|
28
|
+
*/
|
|
29
|
+
hasComponent: (id: string) => boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Install the Blox plugin into your Vue app
|
|
32
|
+
*/
|
|
33
|
+
install: (app: App) => void;
|
|
34
|
+
}
|
|
35
|
+
export interface RegisterOptions {
|
|
36
|
+
/**
|
|
37
|
+
* Category to assign to the components
|
|
38
|
+
*/
|
|
39
|
+
category?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Skip validation for component configs
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
skipValidation?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface RouteOptions {
|
|
47
|
+
/**
|
|
48
|
+
* Base path for the preview routes
|
|
49
|
+
* @default '/blox'
|
|
50
|
+
*/
|
|
51
|
+
basePath?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Path for the external preview route
|
|
54
|
+
* @default '/preview/:pageId?'
|
|
55
|
+
*/
|
|
56
|
+
previewPath?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Path for the render page route
|
|
59
|
+
* @default '/render/:pageId?'
|
|
60
|
+
*/
|
|
61
|
+
renderPath?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Additional route meta properties
|
|
64
|
+
*/
|
|
65
|
+
meta?: Record<string, any>;
|
|
66
|
+
}
|
|
67
|
+
export interface BloxOptions {
|
|
68
|
+
/**
|
|
69
|
+
* Enable debug mode for additional logging
|
|
70
|
+
* @default false
|
|
71
|
+
*/
|
|
72
|
+
debug?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Automatically register base components on first registerComponents call
|
|
75
|
+
* @default true
|
|
76
|
+
*/
|
|
77
|
+
autoRegisterBaseComponents?: boolean;
|
|
78
|
+
}
|
|
2
79
|
/**
|
|
3
|
-
*
|
|
4
|
-
* Call this in your project's setup to make base components available
|
|
80
|
+
* Validation error class
|
|
5
81
|
*/
|
|
6
|
-
export declare
|
|
82
|
+
export declare class ComponentValidationError extends Error {
|
|
83
|
+
componentId?: string | undefined;
|
|
84
|
+
constructor(message: string, componentId?: string | undefined);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Create a new Blox instance with a fluent API
|
|
88
|
+
*
|
|
89
|
+
* @param options - Configuration options for the Blox instance
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* import { createBlox, ButtonConfig, TextConfig } from '@bagelink/blox'
|
|
94
|
+
* import { MyCustomComp } from './components'
|
|
95
|
+
*
|
|
96
|
+
* const blox = createBlox({ debug: true })
|
|
97
|
+
* blox.registerComponents([ButtonConfig, TextConfig, MyCustomComp])
|
|
98
|
+
* blox.registerRoutes(router)
|
|
99
|
+
*
|
|
100
|
+
* app.use(blox)
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
export declare function createBlox(options?: BloxOptions): BloxInstance;
|
|
104
|
+
/**
|
|
105
|
+
* Helper to create a custom component configuration with better TypeScript inference
|
|
106
|
+
*/
|
|
107
|
+
export declare function createComponentConfig<T extends ComponentConfig>(config: T): T;
|
|
7
108
|
/**
|
|
8
109
|
* Get all component configurations (base + custom)
|
|
9
110
|
* This returns both the Vue components and their editor schemas
|
|
10
111
|
*/
|
|
11
112
|
export declare function getAllComponentConfigs(customConfigs?: ComponentConfig[]): ComponentConfig[];
|
|
12
113
|
/**
|
|
13
|
-
*
|
|
114
|
+
* Register all base components from the library
|
|
115
|
+
* Call this in your project's setup to make base components available
|
|
116
|
+
*
|
|
117
|
+
* @deprecated Use `createBlox().registerComponents()` instead for a simpler API
|
|
14
118
|
*/
|
|
15
|
-
export declare function
|
|
119
|
+
export declare function registerBaseComponents(): void;
|
|
16
120
|
/**
|
|
17
121
|
* Register a single custom component
|
|
122
|
+
*
|
|
123
|
+
* @deprecated Use `createBlox().registerComponents()` instead for a simpler API
|
|
18
124
|
*/
|
|
19
125
|
export declare function registerCustomComponent(config: ComponentConfig): void;
|
|
20
126
|
/**
|
|
21
127
|
* Register multiple custom components
|
|
128
|
+
*
|
|
129
|
+
* @deprecated Use `createBlox().registerComponents()` instead for a simpler API
|
|
22
130
|
*/
|
|
23
131
|
export declare function registerCustomComponents(configs: ComponentConfig[]): void;
|
|
24
132
|
//# sourceMappingURL=setup.d.ts.map
|
package/dist/setup.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../setup.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../setup.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC9B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAKpF,MAAM,WAAW,YAAY;IAC5B;;;OAGG;IACH,kBAAkB,EAAE,CACnB,UAAU,EAAE,eAAe,GAAG,eAAe,EAAE,EAC/C,OAAO,CAAC,EAAE,eAAe,KACrB,YAAY,CAAA;IAEjB;;OAEG;IACH,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,KAAK,YAAY,CAAA;IAExE;;OAEG;IACH,uBAAuB,EAAE,MAAM,eAAe,EAAE,CAAA;IAEhD;;OAEG;IACH,uBAAuB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,eAAe,EAAE,CAAA;IAEhE;;OAEG;IACH,eAAe,EAAE,MAAM,MAAM,EAAE,CAAA;IAE/B;;OAEG;IACH,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAA;IAErC;;OAEG;IACH,OAA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zE"}
|
package/dist/styles.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../styles.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExternalPreview.vue.d.ts","sourceRoot":"","sources":["../../views/ExternalPreview.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExternalPreview.vue.d.ts","sourceRoot":"","sources":["../../views/ExternalPreview.vue"],"names":[],"mappings":"AAiaA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAiB,QAAQ,EAAE,MAAM,eAAe,CAAA;AAQ5D,UAAU,KAAK;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,eAAe,CAAC,EAAE,QAAQ,CAAA;IAC1B,gBAAgB,CAAC,EAAE,GAAG,EAAE,CAAA;CACxB;;YAHS,MAAM;sBAEI,GAAG,EAAE;;AAqXzB,wBAQG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderPage.vue.d.ts","sourceRoot":"","sources":["../../views/RenderPage.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RenderPage.vue.d.ts","sourceRoot":"","sources":["../../views/RenderPage.vue"],"names":[],"mappings":"AAiIA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAO7C,UAAU,KAAK;IACd,QAAQ,EAAE,QAAQ,CAAA;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAA;CACzB;;sBADmB,MAAM;;AAsI1B,wBAQG"}
|
package/index.ts
CHANGED
|
@@ -5,27 +5,37 @@
|
|
|
5
5
|
|
|
6
6
|
// Component exports
|
|
7
7
|
export * from './components'
|
|
8
|
+
|
|
8
9
|
// Configuration exports
|
|
9
10
|
export * from './config/baseComponents'
|
|
11
|
+
|
|
12
|
+
// Core exports
|
|
10
13
|
export * from './core/communication'
|
|
11
14
|
export * from './core/registry'
|
|
12
|
-
|
|
13
15
|
export * from './core/renderer'
|
|
14
|
-
// Core exports
|
|
15
16
|
export * from './core/types'
|
|
16
17
|
|
|
17
|
-
// Setup and registration
|
|
18
|
+
// Setup and registration - Main API
|
|
18
19
|
export {
|
|
20
|
+
type BloxInstance,
|
|
21
|
+
type BloxOptions,
|
|
22
|
+
ComponentValidationError,
|
|
23
|
+
createBlox,
|
|
19
24
|
createComponentConfig,
|
|
25
|
+
type RegisterOptions,
|
|
26
|
+
type RouteOptions,
|
|
27
|
+
} from './setup'
|
|
28
|
+
|
|
29
|
+
// Legacy exports (deprecated)
|
|
30
|
+
export {
|
|
20
31
|
getAllComponentConfigs,
|
|
21
32
|
registerBaseComponents,
|
|
22
33
|
registerCustomComponent,
|
|
23
34
|
registerCustomComponents,
|
|
24
35
|
} from './setup'
|
|
25
36
|
|
|
26
|
-
export * from './utils/normalizer'
|
|
27
|
-
|
|
28
37
|
// Utility exports
|
|
38
|
+
export * from './utils/normalizer'
|
|
29
39
|
export * from './utils/styles'
|
|
30
40
|
|
|
31
41
|
// View exports
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bagelink/blox",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.5.
|
|
4
|
+
"version": "1.5.17",
|
|
5
5
|
"description": "Blox page builder library for drag-and-drop page building and static data management",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Bagel Studio",
|
|
@@ -74,7 +74,8 @@
|
|
|
74
74
|
"access": "public"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"vue": "^3.3.0"
|
|
77
|
+
"vue": "^3.3.0",
|
|
78
|
+
"vue-router": "^4.0.0"
|
|
78
79
|
},
|
|
79
80
|
"devDependencies": {
|
|
80
81
|
"@vitejs/plugin-vue": "^5.0.0",
|
|
@@ -84,6 +85,7 @@
|
|
|
84
85
|
"vite-plugin-dts": "^4.0.0",
|
|
85
86
|
"vite-tsconfig-paths": "^5.0.0",
|
|
86
87
|
"vue": "^3.5.16",
|
|
88
|
+
"vue-router": "^4.6.3",
|
|
87
89
|
"vue-tsc": "^2.0.0"
|
|
88
90
|
},
|
|
89
91
|
"scripts": {
|