coralite 0.36.3 → 0.37.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.
Files changed (96) hide show
  1. package/README.md +3 -3
  2. package/bin/coralite.js +3 -3
  3. package/dist/lib/collection-handlers.d.ts +29 -0
  4. package/dist/lib/collection-handlers.d.ts.map +1 -0
  5. package/dist/lib/collection.d.ts +3 -3
  6. package/dist/lib/collection.d.ts.map +1 -1
  7. package/dist/lib/compiler.d.ts +103 -0
  8. package/dist/lib/compiler.d.ts.map +1 -0
  9. package/dist/lib/component-setup.d.ts +37 -0
  10. package/dist/lib/component-setup.d.ts.map +1 -0
  11. package/dist/lib/config.d.ts +0 -3
  12. package/dist/lib/config.d.ts.map +1 -1
  13. package/dist/lib/coralite-element.d.ts +6 -5
  14. package/dist/lib/coralite-element.d.ts.map +1 -1
  15. package/dist/lib/coralite-element.js +63 -486
  16. package/dist/lib/coralite-element.js.map +4 -4
  17. package/dist/lib/coralite.d.ts +10 -709
  18. package/dist/lib/coralite.d.ts.map +1 -1
  19. package/dist/lib/hooks.d.ts +59 -0
  20. package/dist/lib/hooks.d.ts.map +1 -0
  21. package/dist/lib/index.d.ts +7 -9
  22. package/dist/lib/index.d.ts.map +1 -1
  23. package/dist/lib/index.js +4964 -4282
  24. package/dist/lib/index.js.map +4 -4
  25. package/dist/lib/parser.d.ts +46 -0
  26. package/dist/lib/parser.d.ts.map +1 -0
  27. package/dist/lib/plugin-setup.d.ts +26 -0
  28. package/dist/lib/plugin-setup.d.ts.map +1 -0
  29. package/dist/lib/plugin.d.ts.map +1 -1
  30. package/dist/lib/renderer.d.ts +46 -0
  31. package/dist/lib/renderer.d.ts.map +1 -0
  32. package/dist/lib/script-manager.d.ts +25 -18
  33. package/dist/lib/script-manager.d.ts.map +1 -1
  34. package/dist/lib/{client-runtime.d.ts → utils/client/runtime.d.ts} +2 -2
  35. package/dist/lib/utils/client/runtime.d.ts.map +1 -0
  36. package/dist/lib/{utils.d.ts → utils/core.d.ts} +9 -60
  37. package/dist/lib/utils/core.d.ts.map +1 -0
  38. package/dist/lib/utils/errors.d.ts +56 -0
  39. package/dist/lib/utils/errors.d.ts.map +1 -0
  40. package/dist/lib/utils/index.d.ts +5 -0
  41. package/dist/lib/utils/index.d.ts.map +1 -0
  42. package/dist/lib/{dom.d.ts → utils/server/dom.d.ts} +21 -10
  43. package/dist/lib/utils/server/dom.d.ts.map +1 -0
  44. package/dist/lib/utils/server/errors.d.ts +15 -0
  45. package/dist/lib/utils/server/errors.d.ts.map +1 -0
  46. package/dist/lib/{html.d.ts → utils/server/html.d.ts} +12 -10
  47. package/dist/lib/utils/server/html.d.ts.map +1 -0
  48. package/dist/lib/utils/server/index.d.ts +9 -0
  49. package/dist/lib/utils/server/index.d.ts.map +1 -0
  50. package/dist/lib/utils/server/manifest.d.ts +32 -0
  51. package/dist/lib/utils/server/manifest.d.ts.map +1 -0
  52. package/dist/lib/{parse.d.ts → utils/server/parse.d.ts} +9 -9
  53. package/dist/lib/utils/server/parse.d.ts.map +1 -0
  54. package/dist/lib/{render-helpers.d.ts → utils/server/render.d.ts} +7 -7
  55. package/dist/lib/utils/server/render.d.ts.map +1 -0
  56. package/dist/lib/utils/server/server.d.ts +56 -0
  57. package/dist/lib/utils/server/server.d.ts.map +1 -0
  58. package/dist/lib/{style-transform.d.ts → utils/server/style.d.ts} +7 -3
  59. package/dist/lib/utils/server/style.d.ts.map +1 -0
  60. package/dist/lib/utils/tags.d.ts.map +1 -0
  61. package/dist/lib/{type-helper.d.ts → utils/types.d.ts} +10 -10
  62. package/dist/lib/utils/types.d.ts.map +1 -0
  63. package/dist/plugins/index.d.ts +0 -1
  64. package/dist/plugins/metadata.d.ts.map +1 -1
  65. package/dist/plugins/static-assets.d.ts +2 -1
  66. package/dist/plugins/static-assets.d.ts.map +1 -1
  67. package/dist/types/collection.d.ts +42 -0
  68. package/dist/types/collection.d.ts.map +1 -1
  69. package/dist/types/core.d.ts +210 -4
  70. package/dist/types/core.d.ts.map +1 -1
  71. package/dist/types/dom.d.ts +92 -14
  72. package/dist/types/dom.d.ts.map +1 -1
  73. package/dist/types/index.d.ts +7 -68
  74. package/dist/types/index.d.ts.map +1 -1
  75. package/dist/types/module.d.ts +4 -0
  76. package/dist/types/module.d.ts.map +1 -1
  77. package/dist/types/plugin.d.ts +104 -29
  78. package/dist/types/plugin.d.ts.map +1 -1
  79. package/dist/types/script.d.ts +12 -11
  80. package/dist/types/script.d.ts.map +1 -1
  81. package/llms.txt +234 -25
  82. package/package.json +20 -3
  83. package/dist/lib/client-runtime.d.ts.map +0 -1
  84. package/dist/lib/dom.d.ts.map +0 -1
  85. package/dist/lib/errors.d.ts +0 -16
  86. package/dist/lib/errors.d.ts.map +0 -1
  87. package/dist/lib/html.d.ts.map +0 -1
  88. package/dist/lib/parse.d.ts.map +0 -1
  89. package/dist/lib/render-helpers.d.ts.map +0 -1
  90. package/dist/lib/style-transform.d.ts.map +0 -1
  91. package/dist/lib/tags.d.ts.map +0 -1
  92. package/dist/lib/type-helper.d.ts.map +0 -1
  93. package/dist/lib/utils.d.ts.map +0 -1
  94. package/dist/plugins/refs.d.ts +0 -5
  95. package/dist/plugins/refs.d.ts.map +0 -1
  96. /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: Global Context | Phase 2: Component Arguments
196
+ // Phase 1: Plugin Context | Phase 2: Component Arguments
197
197
  exports: {
198
- getData: (context) => (query) => {
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: (globalCtx) => (instanceCtx) => () => {
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 { Coralite } from '../dist/lib/index.js'
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 = new 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"}
@@ -63,7 +63,7 @@ declare class CoraliteCollection {
63
63
  * @type {Object.<string, CoraliteCollectionItem[]>}
64
64
  */
65
65
  listByPath: {
66
- [x: string]: import("../types/collection.js").CoraliteCollectionItem[];
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]: import("../types/collection.js").CoraliteCollectionItem;
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<import("../types/collection.js").CoraliteCollectionItem>;
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":";AAKA;;;;;;;GAOG;AAEH;;;;;;;;;GASG;AACH,8CALG;IAAyB,OAAO,GAAxB,MAAM;IAC+B,KAAK,GAA1C,0BAA0B;IACc,QAAQ,GAAhD,6BAA6B;IACW,QAAQ,GAAhD,6BAA6B;CACvC,QAgDA;;IAlED;;;;;;;OAOG;IAEH;;;;;;;;;OASG;IACH,sBALG;QAAyB,OAAO,GAAxB,MAAM;QAC+B,KAAK,GAA1C,0BAA0B;QACc,QAAQ,GAAhD,6BAA6B;QACW,QAAQ,GAAhD,6BAA6B;KACvC,EAgDA;IA9CC;;OAEG;IACH,gBAAyC;IAMzC;;;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,CAiE3C;IAED;;;;;OAKG;IACH,kBAHW,QAAQ,GAAG,MAAM,iBAwE3B;IAED;;;;;OAKG;IACH,kBAHW,sBAAsB,GAAC,MAAM,oEAmEvC;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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DA1WmB,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"}
@@ -1,6 +1,3 @@
1
- /**
2
- * @import {CoraliteConfig} from '../types/index.js'
3
- */
4
1
  /**
5
2
  * Validates and defines a Coralite configuration object
6
3
  * @param {CoraliteConfig} options - The configuration options to validate and define
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../lib/config.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;GAKG;AACH,sCAJW,cAAc,GACZ,cAAc,CAwD1B;oCA9DgC,mBAAmB"}
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
- * * This class acts as the client-side runtime engine. It manages DOM hydration,
39
- * native Web Component lifecycles, batched reactive state management (via Proxies),
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;AA0kBD;;;;;;;;;;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;AA/mBD;;;;;;;;;;GAUG;AAEH;;;;;;GAMG;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;;;;OAIG;IACH,6BAkBC;IAED;;;;;;;OAOG;IACH,+BAJW,MAAM,UACN,MAAM,GAAC,IAAI,UACX,MAAM,GAAC,IAAI,QAWrB;IAED;;;;;OAKG;IACH,oBA2EC;IAED;;;;;;OAMG;IACH,6BAYC;IAED;;;;;OAKG;IACH,oBAHW,MAAM,EAAE,GACN,IAAI,GAAC,IAAI,CAYrB;IAED;;;;OAIG;IACH,uBAiCC;IAED;;;;OAIG;IACH,wBASC;IAED;;;;;;OAMG;IACH,mBA2GC;IAED;;;;OAIG;IACH,sBA4BC;IAED;;;;;;OAMG;IACH,cA8BC;CACF;;;;;iBApkBa,MAAM;;;;mBACN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uEA/DV,oBAAoB;sEAApB,oBAAoB;8DAApB,oBAAoB"}
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,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