coralite 0.36.3 → 0.37.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/README.md +3 -3
- package/bin/coralite.js +3 -3
- package/dist/lib/collection-handlers.d.ts +29 -0
- package/dist/lib/collection-handlers.d.ts.map +1 -0
- package/dist/lib/collection.d.ts +3 -3
- package/dist/lib/collection.d.ts.map +1 -1
- package/dist/lib/compiler.d.ts +103 -0
- package/dist/lib/compiler.d.ts.map +1 -0
- package/dist/lib/component-setup.d.ts +37 -0
- package/dist/lib/component-setup.d.ts.map +1 -0
- package/dist/lib/config.d.ts +0 -3
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/coralite-element.d.ts +6 -5
- package/dist/lib/coralite-element.d.ts.map +1 -1
- package/dist/lib/coralite-element.js +63 -486
- package/dist/lib/coralite-element.js.map +4 -4
- package/dist/lib/coralite.d.ts +10 -709
- package/dist/lib/coralite.d.ts.map +1 -1
- package/dist/lib/hooks.d.ts +59 -0
- package/dist/lib/hooks.d.ts.map +1 -0
- package/dist/lib/index.d.ts +7 -9
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +5025 -4289
- package/dist/lib/index.js.map +4 -4
- package/dist/lib/parser.d.ts +46 -0
- package/dist/lib/parser.d.ts.map +1 -0
- package/dist/lib/plugin-setup.d.ts +26 -0
- package/dist/lib/plugin-setup.d.ts.map +1 -0
- package/dist/lib/plugin.d.ts.map +1 -1
- package/dist/lib/renderer.d.ts +46 -0
- package/dist/lib/renderer.d.ts.map +1 -0
- package/dist/lib/script-manager.d.ts +25 -18
- package/dist/lib/script-manager.d.ts.map +1 -1
- package/dist/lib/{client-runtime.d.ts → utils/client/runtime.d.ts} +2 -2
- package/dist/lib/utils/client/runtime.d.ts.map +1 -0
- package/dist/lib/{utils.d.ts → utils/core.d.ts} +9 -60
- package/dist/lib/utils/core.d.ts.map +1 -0
- package/dist/lib/utils/errors.d.ts +56 -0
- package/dist/lib/utils/errors.d.ts.map +1 -0
- package/dist/lib/utils/index.d.ts +5 -0
- package/dist/lib/utils/index.d.ts.map +1 -0
- package/dist/lib/{dom.d.ts → utils/server/dom.d.ts} +21 -10
- package/dist/lib/utils/server/dom.d.ts.map +1 -0
- package/dist/lib/utils/server/errors.d.ts +15 -0
- package/dist/lib/utils/server/errors.d.ts.map +1 -0
- package/dist/lib/{html.d.ts → utils/server/html.d.ts} +12 -10
- package/dist/lib/utils/server/html.d.ts.map +1 -0
- package/dist/lib/utils/server/index.d.ts +9 -0
- package/dist/lib/utils/server/index.d.ts.map +1 -0
- package/dist/lib/utils/server/manifest.d.ts +32 -0
- package/dist/lib/utils/server/manifest.d.ts.map +1 -0
- package/dist/lib/{parse.d.ts → utils/server/parse.d.ts} +8 -22
- package/dist/lib/utils/server/parse.d.ts.map +1 -0
- package/dist/lib/{render-helpers.d.ts → utils/server/render.d.ts} +7 -7
- package/dist/lib/utils/server/render.d.ts.map +1 -0
- package/dist/lib/utils/server/server.d.ts +56 -0
- package/dist/lib/utils/server/server.d.ts.map +1 -0
- package/dist/lib/{style-transform.d.ts → utils/server/style.d.ts} +7 -3
- package/dist/lib/utils/server/style.d.ts.map +1 -0
- package/dist/lib/utils/tags.d.ts.map +1 -0
- package/dist/lib/{type-helper.d.ts → utils/types.d.ts} +10 -10
- package/dist/lib/utils/types.d.ts.map +1 -0
- package/dist/plugins/index.d.ts +0 -1
- package/dist/plugins/metadata.d.ts.map +1 -1
- package/dist/plugins/static-assets.d.ts +2 -1
- package/dist/plugins/static-assets.d.ts.map +1 -1
- package/dist/types/collection.d.ts +42 -0
- package/dist/types/collection.d.ts.map +1 -1
- package/dist/types/core.d.ts +210 -4
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/dom.d.ts +92 -14
- package/dist/types/dom.d.ts.map +1 -1
- package/dist/types/index.d.ts +7 -68
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/module.d.ts +4 -0
- package/dist/types/module.d.ts.map +1 -1
- package/dist/types/plugin.d.ts +104 -29
- package/dist/types/plugin.d.ts.map +1 -1
- package/dist/types/script.d.ts +12 -11
- package/dist/types/script.d.ts.map +1 -1
- package/llms.txt +234 -25
- package/package.json +20 -3
- package/dist/lib/client-runtime.d.ts.map +0 -1
- package/dist/lib/dom.d.ts.map +0 -1
- package/dist/lib/errors.d.ts +0 -16
- package/dist/lib/errors.d.ts.map +0 -1
- package/dist/lib/html.d.ts.map +0 -1
- package/dist/lib/parse.d.ts.map +0 -1
- package/dist/lib/render-helpers.d.ts.map +0 -1
- package/dist/lib/style-transform.d.ts.map +0 -1
- package/dist/lib/tags.d.ts.map +0 -1
- package/dist/lib/type-helper.d.ts.map +0 -1
- package/dist/lib/utils.d.ts.map +0 -1
- package/dist/plugins/refs.d.ts +0 -5
- package/dist/plugins/refs.d.ts.map +0 -1
- /package/dist/lib/{tags.d.ts → utils/tags.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -193,9 +193,9 @@ export default function myPlugin(options = {}) {
|
|
|
193
193
|
name: 'my-plugin',
|
|
194
194
|
|
|
195
195
|
server: {
|
|
196
|
-
// Phase 1:
|
|
196
|
+
// Phase 1: Plugin Context | Phase 2: Component Arguments
|
|
197
197
|
exports: {
|
|
198
|
-
getData: (
|
|
198
|
+
getData: (pluginContext) => (query) => {
|
|
199
199
|
return { custom: 'data' }
|
|
200
200
|
}
|
|
201
201
|
},
|
|
@@ -207,7 +207,7 @@ export default function myPlugin(options = {}) {
|
|
|
207
207
|
client: {
|
|
208
208
|
// Injects a utility directly into the component's 'script' context
|
|
209
209
|
context: {
|
|
210
|
-
myHelper: (
|
|
210
|
+
myHelper: (pluginContext) => (instanceCtx) => () => {
|
|
211
211
|
console.log('Hello from component', instanceCtx.instanceId)
|
|
212
212
|
}
|
|
213
213
|
}
|
package/bin/coralite.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env -S node --experimental-vm-modules --experimental-import-meta-resolve
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { createCoralite } from '../lib/index.js'
|
|
4
4
|
import { Command } from 'commander'
|
|
5
5
|
import kleur from 'kleur'
|
|
6
6
|
import { pathToFileURL } from 'node:url'
|
|
@@ -97,7 +97,7 @@ if (config && config.plugins) {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
// Create coralite instance
|
|
100
|
-
const coralite =
|
|
100
|
+
const coralite = await createCoralite({
|
|
101
101
|
...coraliteOptions,
|
|
102
102
|
onError: ({ level, message, error }) => {
|
|
103
103
|
if (level === 'ERR') {
|
|
@@ -113,7 +113,6 @@ const coralite = new Coralite({
|
|
|
113
113
|
}
|
|
114
114
|
})
|
|
115
115
|
// initializes Coralite with the provided options and compiles documents
|
|
116
|
-
await coralite.initialise()
|
|
117
116
|
// compiles all pages using Coralite
|
|
118
117
|
|
|
119
118
|
if (options.dryRun) {
|
|
@@ -130,6 +129,7 @@ if (options.dryRun) {
|
|
|
130
129
|
process.stdout.write(PAD + `${kleur.bold('- Path:')} ${document.path.pathname}\n`)
|
|
131
130
|
process.stdout.write(PAD + `${kleur.bold('- Built in:')} ${Math.floor(document.duration)}ms\n\n`)
|
|
132
131
|
process.stdout.write(border + kleur.inverse(' Content start ') + border + '\n\n')
|
|
132
|
+
// @ts-ignore
|
|
133
133
|
process.stdout.write(document.html)
|
|
134
134
|
process.stdout.write('\n\n' + border + kleur.inverse(' Content end ') + border + '\n')
|
|
135
135
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {
|
|
3
|
+
* CoraliteInstance,
|
|
4
|
+
* CoraliteOnError
|
|
5
|
+
* } from '../types/index.js'
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Factory for collection handlers.
|
|
9
|
+
*
|
|
10
|
+
* @param {Object} context - The context containing shared dependencies for the handlers.
|
|
11
|
+
* @param {CoraliteInstance} context.app - The global Coralite app instance.
|
|
12
|
+
* @param {Function} context.triggerHook - The function used to trigger plugin hooks.
|
|
13
|
+
* @param {CoraliteOnError} context.handleError - The callback for handling errors during collection events.
|
|
14
|
+
* @param {Function} [context.evaluate] - The evaluation function for components.
|
|
15
|
+
* @param {any} [context.scriptManager] - The script manager for components.
|
|
16
|
+
* @param {Function} [context.createSession] - The session creation function.
|
|
17
|
+
* @returns {Object}
|
|
18
|
+
*/
|
|
19
|
+
export function createPageHandlers({ app, triggerHook, handleError, evaluate, scriptManager, createSession }: {
|
|
20
|
+
app: CoraliteInstance;
|
|
21
|
+
triggerHook: Function;
|
|
22
|
+
handleError: CoraliteOnError;
|
|
23
|
+
evaluate?: Function;
|
|
24
|
+
scriptManager?: any;
|
|
25
|
+
createSession?: Function;
|
|
26
|
+
}): any;
|
|
27
|
+
import type { CoraliteInstance } from '../types/index.js';
|
|
28
|
+
import type { CoraliteOnError } from '../types/index.js';
|
|
29
|
+
//# sourceMappingURL=collection-handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-handlers.d.ts","sourceRoot":"","sources":["../../lib/collection-handlers.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AAEH;;;;;;;;;;;GAWG;AACH,8GARG;IAAkC,GAAG,EAA7B,gBAAgB;IACE,WAAW;IACJ,WAAW,EAApC,eAAe;IACI,QAAQ;IACb,aAAa,GAA3B,GAAG;IACgB,aAAa;CACxC,OAgRF;sCA7RS,mBAAmB;qCAAnB,mBAAmB"}
|
package/dist/lib/collection.d.ts
CHANGED
|
@@ -63,7 +63,7 @@ declare class CoraliteCollection {
|
|
|
63
63
|
* @type {Object.<string, CoraliteCollectionItem[]>}
|
|
64
64
|
*/
|
|
65
65
|
listByPath: {
|
|
66
|
-
[x: string]:
|
|
66
|
+
[x: string]: CoraliteCollectionItem[];
|
|
67
67
|
};
|
|
68
68
|
/**
|
|
69
69
|
* An object mapping unique identifiers to HTMLData objects.
|
|
@@ -71,7 +71,7 @@ declare class CoraliteCollection {
|
|
|
71
71
|
* @type {Object.<string, CoraliteCollectionItem>}
|
|
72
72
|
*/
|
|
73
73
|
collection: {
|
|
74
|
-
[x: string]:
|
|
74
|
+
[x: string]: CoraliteCollectionItem;
|
|
75
75
|
};
|
|
76
76
|
/**
|
|
77
77
|
* Callback triggered when setting a new item
|
|
@@ -108,7 +108,7 @@ declare class CoraliteCollection {
|
|
|
108
108
|
* @param {CoraliteCollectionItem|string} value - The HTMLData object to be updated or added.
|
|
109
109
|
* @throws {Error} If invalid input is provided
|
|
110
110
|
*/
|
|
111
|
-
updateItem(value: CoraliteCollectionItem | string): Promise<
|
|
111
|
+
updateItem(value: CoraliteCollectionItem | string): Promise<CoraliteCollectionItem>;
|
|
112
112
|
/**
|
|
113
113
|
* Retrieves an item by its unique identifier
|
|
114
114
|
* @param {string} id - Unique identifier of the item
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../lib/collection.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../lib/collection.js"],"names":[],"mappings":";AAMA;;;;;;;GAOG;AAEH;;;;;;;;;GASG;AACH,8CALG;IAAyB,OAAO,GAAxB,MAAM;IAC+B,KAAK,GAA1C,0BAA0B;IACc,QAAQ,GAAhD,6BAA6B;IACW,QAAQ,GAAhD,6BAA6B;CACvC,QAkDA;;IApED;;;;;;;OAOG;IAEH;;;;;;;;;OASG;IACH,sBALG;QAAyB,OAAO,GAAxB,MAAM;QAC+B,KAAK,GAA1C,0BAA0B;QACc,QAAQ,GAAhD,6BAA6B;QACW,QAAQ,GAAhD,6BAA6B;KACvC,EAkDA;IAhDC;;OAEG;IACH,gBAAyC;IAQzC;;;OAGG;IACH,MAFU,sBAAsB,EAAE,CAEpB;IAEd;;;;OAIG;IACH;;MAAqC;IAErC;;;;OAIG;IACH;;MAAqC;IAErC;;;OAGG;IACH,QAFU,0BAA0B,GAAG,SAAS,CAErB;IAE3B;;;OAGG;IACH,WAFU,6BAA6B,GAAG,SAAS,CAElB;IAEjC;;;OAGG;IACH,WAFU,6BAA6B,GAAG,SAAS,CAElB;IAGnC;;;;;OAKG;IACH,eAHW,QAAQ,GAAC,MAAM,GACb,OAAO,CAAC,sBAAsB,CAAC,CAqE3C;IAED;;;;;OAKG;IACH,kBAHW,QAAQ,GAAG,MAAM,iBAwE3B;IAED;;;;;OAKG;IACH,kBAHW,sBAAsB,GAAC,MAAM,mCAkFvC;IAED;;;;OAIG;IACH,YAHW,MAAM,GACJ,sBAAsB,GAAG,SAAS,CAQ9C;IAED;;;;OAIG;IACH,uBAHW,MAAM,GACJ,sBAAsB,EAAE,GAAG,SAAS,CAQhD;IAED;;;;;;OAMG;IACH,sBAJW,MAAM,GACJ,OAAO,CAAC,QAAQ,CAAC,CA6B7B;;gDA1WmB,mBAAmB;mDAAnB,mBAAmB;mDAAnB,mBAAmB;4CAAnB,mBAAmB;8BAAnB,mBAAmB"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a custom module linker callback for the Node.js VM context.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} options - The options used to create the module linker.
|
|
5
|
+
* @param {CoraliteFilePath} options.path - The file path metadata of the component
|
|
6
|
+
* @param {CoralitePluginContext} options.context - Contextual rendering data
|
|
7
|
+
* @param {Object} options.source - Framework source context
|
|
8
|
+
* @param {Object} options.plugins - Bound plugins
|
|
9
|
+
* @param {Function} options.importModuleDynamically - The dynamic import callback
|
|
10
|
+
* @returns {(specifier: string, referencingModule: Module, extra: { attributes: any }) => Promise<Module>}
|
|
11
|
+
*/
|
|
12
|
+
export function createModuleLinker({ path, context, source, plugins, importModuleDynamically }: {
|
|
13
|
+
path: CoraliteFilePath;
|
|
14
|
+
context: CoralitePluginContext;
|
|
15
|
+
source: any;
|
|
16
|
+
plugins: any;
|
|
17
|
+
importModuleDynamically: Function;
|
|
18
|
+
}): (specifier: string, referencingModule: Module, extra: {
|
|
19
|
+
attributes: any;
|
|
20
|
+
}) => Promise<Module>;
|
|
21
|
+
/**
|
|
22
|
+
* Parses a Coralite module script and evaluates it using SourceTextModule.
|
|
23
|
+
*
|
|
24
|
+
* @param {Object} options - The options used for module evaluation in development mode.
|
|
25
|
+
* @param {CoraliteModule} options.module - The Coralite module to parse
|
|
26
|
+
* @param {CoraliteModuleDefinitions} options.state - Replacement tokens for the component
|
|
27
|
+
* @param {CoralitePage} options.page - The global page object
|
|
28
|
+
* @param {any} options.root - The Coralite module to parse
|
|
29
|
+
* @param {string} options.contextId - Context Id
|
|
30
|
+
* @param {CoraliteSession} options.session - Render Context
|
|
31
|
+
* @param {boolean} options.noHydration - No hydration flag
|
|
32
|
+
* @param {Object} options.app - The Coralite instance
|
|
33
|
+
* @param {Object} options.source - Framework source context
|
|
34
|
+
* @param {Function} options.bindPlugins - Function to bind plugins
|
|
35
|
+
* @param {Function} options.defineComponent - Function to define component
|
|
36
|
+
* @param {Function} options.createExecutionError - Function to create execution error
|
|
37
|
+
* @param {Function} options.getComponent - Function to get component
|
|
38
|
+
*
|
|
39
|
+
* @returns {Promise<CoraliteModuleDefinitions>}
|
|
40
|
+
*/
|
|
41
|
+
export function evaluateDevelopment({ module, state, page, root, contextId, session, noHydration, app, source, bindPlugins, defineComponent, createExecutionError, getComponent }: {
|
|
42
|
+
module: CoraliteModule;
|
|
43
|
+
state: CoraliteModuleDefinitions;
|
|
44
|
+
page: CoralitePage;
|
|
45
|
+
root: any;
|
|
46
|
+
contextId: string;
|
|
47
|
+
session: CoraliteSession;
|
|
48
|
+
noHydration: boolean;
|
|
49
|
+
app: any;
|
|
50
|
+
source: any;
|
|
51
|
+
bindPlugins: Function;
|
|
52
|
+
defineComponent: Function;
|
|
53
|
+
createExecutionError: Function;
|
|
54
|
+
getComponent: Function;
|
|
55
|
+
}): Promise<CoraliteModuleDefinitions>;
|
|
56
|
+
/**
|
|
57
|
+
* Parses a Coralite module script and compiles it into JavaScript using esbuild.
|
|
58
|
+
*
|
|
59
|
+
* @param {Object} options - The options used for module evaluation.
|
|
60
|
+
* @param {CoraliteModule} options.module - The Coralite module to parse
|
|
61
|
+
* @param {CoraliteModuleDefinitions} options.state - Replacement tokens for the component
|
|
62
|
+
* @param {CoralitePage} options.page - The global page object
|
|
63
|
+
* @param {any} options.root - The Coralite module to parse
|
|
64
|
+
* @param {string} options.contextId - Context Id
|
|
65
|
+
* @param {CoraliteSession} options.session - Render Context
|
|
66
|
+
* @param {boolean} options.noHydration - No hydration flag
|
|
67
|
+
* @param {Object} options.app - The Coralite instance
|
|
68
|
+
* @param {Object} options.source - Framework source context
|
|
69
|
+
* @param {Function} options.bindPlugins - Function to bind plugins
|
|
70
|
+
* @param {Function} options.defineComponent - Function to define component
|
|
71
|
+
* @param {Function} options.createExecutionError - Function to create execution error
|
|
72
|
+
* @param {Function} options.getComponent - Function to get component
|
|
73
|
+
*
|
|
74
|
+
* @returns {Promise<CoraliteModuleDefinitions>}
|
|
75
|
+
*/
|
|
76
|
+
export function evaluateProduction({ module, state, page, root, contextId, session, noHydration, app, source, bindPlugins, defineComponent, createExecutionError, getComponent }: {
|
|
77
|
+
module: CoraliteModule;
|
|
78
|
+
state: CoraliteModuleDefinitions;
|
|
79
|
+
page: CoralitePage;
|
|
80
|
+
root: any;
|
|
81
|
+
contextId: string;
|
|
82
|
+
session: CoraliteSession;
|
|
83
|
+
noHydration: boolean;
|
|
84
|
+
app: any;
|
|
85
|
+
source: any;
|
|
86
|
+
bindPlugins: Function;
|
|
87
|
+
defineComponent: Function;
|
|
88
|
+
createExecutionError: Function;
|
|
89
|
+
getComponent: Function;
|
|
90
|
+
}): Promise<CoraliteModuleDefinitions>;
|
|
91
|
+
/**
|
|
92
|
+
* Evaluates a Coralite module script using the appropriate engine for the current mode.
|
|
93
|
+
* @param {any} options - The evaluation options for the module.
|
|
94
|
+
*/
|
|
95
|
+
export function evaluate(options: any): Promise<CoraliteModuleDefinitions>;
|
|
96
|
+
import type { CoraliteFilePath } from '../types/index.js';
|
|
97
|
+
import type { CoralitePluginContext } from '../types/index.js';
|
|
98
|
+
import type { Module } from 'node:vm';
|
|
99
|
+
import type { CoraliteModule } from '../types/index.js';
|
|
100
|
+
import type { CoraliteModuleDefinitions } from '../types/index.js';
|
|
101
|
+
import type { CoralitePage } from '../types/index.js';
|
|
102
|
+
import type { CoraliteSession } from '../types/index.js';
|
|
103
|
+
//# sourceMappingURL=compiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler.d.ts","sourceRoot":"","sources":["../../lib/compiler.js"],"names":[],"mappings":"AAeA;;;;;;;;;;GAUG;AACH,gGAPG;IAAkC,IAAI,EAA9B,gBAAgB;IACe,OAAO,EAAtC,qBAAqB;IACL,MAAM;IACN,OAAO;IACL,uBAAuB;CACjD,GAAU,CAAC,SAAS,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,KAAK,EAAE;IAAE,UAAU,EAAE,GAAG,CAAA;CAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAoGzG;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,mLAhBG;IAAgC,MAAM,EAA9B,cAAc;IACqB,KAAK,EAAxC,yBAAyB;IACH,IAAI,EAA1B,YAAY;IACC,IAAI,EAAjB,GAAG;IACa,SAAS,EAAzB,MAAM;IACmB,OAAO,EAAhC,eAAe;IACE,WAAW,EAA5B,OAAO;IACS,GAAG;IACH,MAAM;IACJ,WAAW;IACX,eAAe;IACf,oBAAoB;IACpB,YAAY;CAEtC,GAAU,OAAO,CAAC,yBAAyB,CAAC,CAmH9C;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,kLAhBG;IAAgC,MAAM,EAA9B,cAAc;IACqB,KAAK,EAAxC,yBAAyB;IACH,IAAI,EAA1B,YAAY;IACC,IAAI,EAAjB,GAAG;IACa,SAAS,EAAzB,MAAM;IACmB,OAAO,EAAhC,eAAe;IACE,WAAW,EAA5B,OAAO;IACS,GAAG;IACH,MAAM;IACJ,WAAW;IACX,eAAe;IACf,oBAAoB;IACpB,YAAY;CAEtC,GAAU,OAAO,CAAC,yBAAyB,CAAC,CAiH9C;AAED;;;GAGG;AACH,kCAFW,GAAG,sCAOb;sCA1YqI,mBAAmB;2CAAnB,mBAAmB;4BAC9H,SAAS;oCADkG,mBAAmB;+CAAnB,mBAAmB;kCAAnB,mBAAmB;qCAAnB,mBAAmB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {
|
|
3
|
+
* CoralitePluginContext,
|
|
4
|
+
* CoraliteInstance
|
|
5
|
+
* } from '../types/index.js'
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Factory to create the component definition function.
|
|
9
|
+
*
|
|
10
|
+
* @param {Object} dependencies - The dependencies required to create the component definition.
|
|
11
|
+
* @param {CoraliteInstance} dependencies.app - The global Coralite app instance.
|
|
12
|
+
* @returns {Function}
|
|
13
|
+
*/
|
|
14
|
+
export function createComponentDefinition({ app }: {
|
|
15
|
+
app: CoraliteInstance;
|
|
16
|
+
}): Function;
|
|
17
|
+
/**
|
|
18
|
+
* Performs base evaluation and registers a component in the script manager.
|
|
19
|
+
* Used during discovery and updates to lock in the pristine component definition.
|
|
20
|
+
*
|
|
21
|
+
* @param {Object} options - The registration options.
|
|
22
|
+
* @param {any} options.component - The component document.
|
|
23
|
+
* @param {Function} options.evaluate - The evaluation function.
|
|
24
|
+
* @param {any} options.scriptManager - The script manager instance.
|
|
25
|
+
* @param {Function} options.createSession - The session creation function.
|
|
26
|
+
* @param {string} options.mode - The current build mode.
|
|
27
|
+
* @returns {Promise<void>}
|
|
28
|
+
*/
|
|
29
|
+
export function registerBaseComponent({ component, evaluate, scriptManager, createSession, mode }: {
|
|
30
|
+
component: any;
|
|
31
|
+
evaluate: Function;
|
|
32
|
+
scriptManager: any;
|
|
33
|
+
createSession: Function;
|
|
34
|
+
mode: string;
|
|
35
|
+
}): Promise<void>;
|
|
36
|
+
import type { CoraliteInstance } from '../types/index.js';
|
|
37
|
+
//# sourceMappingURL=component-setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-setup.d.ts","sourceRoot":"","sources":["../../lib/component-setup.js"],"names":[],"mappings":"AAUA;;;;;GAKG;AAEH;;;;;;GAMG;AACH,mDAHG;IAAuC,GAAG,EAAlC,gBAAgB;CACxB,YA2MF;AAED;;;;;;;;;;;GAWG;AACH,mGAPG;IAAqB,SAAS,EAAtB,GAAG;IACe,QAAQ;IACb,aAAa,EAA1B,GAAG;IACe,aAAa;IACf,IAAI,EAApB,MAAM;CACd,GAAU,OAAO,CAAC,IAAI,CAAC,CA4FzB;sCA3TS,mBAAmB"}
|
package/dist/lib/config.d.ts
CHANGED
package/dist/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../lib/config.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../lib/config.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,sCAJW,cAAc,GACZ,cAAc,CAwD1B;oCA/DgC,mBAAmB"}
|
|
@@ -35,10 +35,8 @@ export function createCoraliteClass(options: CoraliteComponentOptions, contextGe
|
|
|
35
35
|
*/
|
|
36
36
|
/**
|
|
37
37
|
* Base class for all Coralite custom elements.
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* asynchronous getter race-condition locks, and isomorphic plugin hooks.
|
|
41
|
-
* * @augments HTMLElement
|
|
38
|
+
*
|
|
39
|
+
* @augments HTMLElement
|
|
42
40
|
*/
|
|
43
41
|
export class CoraliteElement extends HTMLElement {
|
|
44
42
|
/**
|
|
@@ -130,8 +128,9 @@ export class CoraliteElement extends HTMLElement {
|
|
|
130
128
|
* Invoked natively when the element is removed from the document.
|
|
131
129
|
* Aborts pending requests and triggers `onDisconnected` plugin hooks
|
|
132
130
|
* to ensure external libraries (e.g., Observers) do not cause memory leaks.
|
|
131
|
+
* @this {any}
|
|
133
132
|
*/
|
|
134
|
-
disconnectedCallback(): void;
|
|
133
|
+
disconnectedCallback(this: any): void;
|
|
135
134
|
/**
|
|
136
135
|
* Invoked natively when an observed HTML attribute changes.
|
|
137
136
|
* Coerces the raw string value based on the component's attribute schema
|
|
@@ -145,6 +144,7 @@ export class CoraliteElement extends HTMLElement {
|
|
|
145
144
|
* Constructs the unified state object.
|
|
146
145
|
* Merges `defaultValues`, JSON hydration payloads, and DOM attributes.
|
|
147
146
|
* Defines getters (wrapping state in a Read-Only proxy) and applies the final Read/Write Proxy.
|
|
147
|
+
* @this {any}
|
|
148
148
|
* @private
|
|
149
149
|
*/
|
|
150
150
|
private _setupState;
|
|
@@ -180,6 +180,7 @@ export class CoraliteElement extends HTMLElement {
|
|
|
180
180
|
* **Async Safety:** Implements a Symbol-based locking mechanism (`renderVersion`)
|
|
181
181
|
* to guarantee that if state mutates while an async getter is pending, the stale
|
|
182
182
|
* Promise will be discarded, preventing DOM race conditions.
|
|
183
|
+
* @this {any}
|
|
183
184
|
* @private
|
|
184
185
|
*/
|
|
185
186
|
private _updateDOM;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coralite-element.d.ts","sourceRoot":"","sources":["../../lib/coralite-element.js"],"names":[],"mappings":"AAuCA;;;;;;GAMG;AACH,8BAJW,GAAG,QACH,WAAS,MAAM,GACb,GAAG,CAmBf;
|
|
1
|
+
{"version":3,"file":"coralite-element.d.ts","sourceRoot":"","sources":["../../lib/coralite-element.js"],"names":[],"mappings":"AAuCA;;;;;;GAMG;AACH,8BAJW,GAAG,QACH,WAAS,MAAM,GACb,GAAG,CAmBf;AAmmBD;;;;;;;;;;GAUG;AACH,6CARW,wBAAwB,kBACxB,WAAS,IAAI,UAErB;IAAyE,uBAAuB,GAAxF,KAAK,CAAC,iDAAiD,CAAC;IACQ,sBAAsB,GAAtF,KAAK,CAAC,gDAAgD,CAAC;IACC,cAAc,GAAtE,KAAK,CAAC,wCAAwC,CAAC;CACvD,GAAU,OAAO,eAAe,CA8BlC;AAxoBD;;;;;;;;;;GAUG;AAEH;;;;GAIG;AACH;IAOI;;;;OAIG;IACH,4BAHU,eAAe,GAAC,IAAI,CAGF;IAE5B;;;;OAIG;IACH,uBAHU,MAAM,GAAC,IAAI,CAGE;IAEvB;;;;OAIG;IACH,kBAHU,MAAO,IAAI,CAGH;IAElB;;;;OAIG;IACH,qBAHU,KAAK,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,IAAI,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC,CAG1D;IAEnB;;;;OAIG;IACH,4BAHU,OAAO,CAGY;IAE7B;;;;OAIG;IACH,iCAHU,MAAM,GAAC,IAAI,CAGY;IAEjC;;;OAGG;IACH,qBAHU,gBAAgB,GAAC,IAAI,CAGV;IAErB;;;;OAIG;IACH,gCAHU,WAAS,IAAI,CAGS;IAEhC;;;;OAIG;IACH,mCAHU;YAAQ,MAAM,GAAE,eAAe;KAAC,GAAC,IAAI,CAGZ;IAEnC;;;;;;;;OAQG;IACH,kBAPU;QACL,uBAAuB,EAAE,KAAK,CAAC,iDAAiD,CAAC,CAAC;QAClF,sBAAsB,EAAE,KAAK,CAAC,gDAAgD,CAAC,CAAC;QAChF,cAAc,EAAE,KAAK,CAAC,wCAAwC,CAAC,CAAA;KAChE,CAOH;IAED;;;OAGG;IACH,kBAFU,wBAAwB,GAAC,IAAI,CAEX;IAG9B;;;;OAIG;IACH,0BAsDC;IAED;;;;;OAKG;IACH,sCAkBC;IAED;;;;;;;OAOG;IACH,+BAJW,MAAM,UACN,MAAM,GAAC,IAAI,UACX,MAAM,GAAC,IAAI,QAWrB;IAED;;;;;;OAMG;IACH,oBAkFC;IAED;;;;;;OAMG;IACH,6BAYC;IAED;;;;;OAKG;IACH,oBAHW,MAAM,EAAE,GACN,IAAI,GAAC,IAAI,CAYrB;IAED;;;;OAIG;IACH,uBAiCC;IAED;;;;OAIG;IACH,wBASC;IAED;;;;;;;OAOG;IACH,mBA2GC;IAED;;;;OAIG;IACH,sBAqCC;IAED;;;;;;OAMG;IACH,cAsCC;CACF;;;;;iBA7lBa,MAAM;;;;mBACN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uEA/DV,oBAAoB;sEAApB,oBAAoB;8DAApB,oBAAoB"}
|