@mintjamsinc/ichigojs 0.1.9 → 0.1.11

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.
@@ -1,5 +1,94 @@
1
1
  // Copyright (c) 2025 MintJams Inc. Licensed under MIT License.
2
+ /**
3
+ * Represents a reusable component definition.
4
+ */
5
+ class VComponent {
6
+ /**
7
+ * The unique identifier for the component.
8
+ */
9
+ id;
10
+ /**
11
+ * The function that creates a new instance of the component.
12
+ */
13
+ createInstance;
14
+ /**
15
+ * The optional template ID for the component.
16
+ * If not specified, defaults to the component ID.
17
+ */
18
+ templateID;
19
+ /**
20
+ * Creates a new component definition.
21
+ * @param id The unique identifier for the component.
22
+ * @param createInstance The function that creates a new instance of the component.
23
+ * @param templateID The optional template ID for the component.
24
+ */
25
+ constructor(id, createInstance, templateID) {
26
+ if (!id || typeof id !== 'string') {
27
+ throw new Error('Component ID must be a non-empty string.');
28
+ }
29
+ if (typeof createInstance !== 'function') {
30
+ throw new Error('createInstance must be a function.');
31
+ }
32
+ this.id = id.trim();
33
+ this.createInstance = createInstance;
34
+ this.templateID = templateID?.trim() || this.id;
35
+ }
36
+ }
37
+
38
+ // Copyright (c) 2025 MintJams Inc. Licensed under MIT License.
39
+ /**
40
+ * A registry for managing component definitions.
41
+ */
2
42
  class VComponentRegistry {
43
+ /**
44
+ * Map of component ID to component definition.
45
+ */
46
+ #components = new Map();
47
+ /**
48
+ * Registers a new component.
49
+ * @param id The unique identifier for the component.
50
+ * @param createInstance The function that creates a new instance of the component.
51
+ * @param templateID The optional template ID for the component.
52
+ * @returns True if the component was registered, false if a component with the same ID already exists.
53
+ */
54
+ register(id, createInstance, templateID) {
55
+ if (this.has(id)) {
56
+ return false;
57
+ }
58
+ const component = new VComponent(id, createInstance, templateID);
59
+ this.#components.set(id, component);
60
+ return true;
61
+ }
62
+ /**
63
+ * Checks if a component with the given ID exists.
64
+ * @param id The component ID to check.
65
+ * @returns True if the component exists, false otherwise.
66
+ */
67
+ has(id) {
68
+ return this.#components.has(id);
69
+ }
70
+ /**
71
+ * Gets a component by its ID.
72
+ * @param id The component ID to retrieve.
73
+ * @returns The component definition, or undefined if not found.
74
+ */
75
+ get(id) {
76
+ return this.#components.get(id);
77
+ }
78
+ /**
79
+ * Removes a component from the registry.
80
+ * @param id The component ID to remove.
81
+ * @returns True if the component was removed, false if it didn't exist.
82
+ */
83
+ unregister(id) {
84
+ return this.#components.delete(id);
85
+ }
86
+ /**
87
+ * Clears all registered components.
88
+ */
89
+ clear() {
90
+ this.#components.clear();
91
+ }
3
92
  }
4
93
 
5
94
  // Copyright (c) 2025 MintJams Inc. Licensed under MIT License.
@@ -68,10 +157,14 @@ var StandardDirectiveName;
68
157
  StandardDirectiveName["V_BIND"] = "v-bind";
69
158
  /** Two-way data binding directives. */
70
159
  StandardDirectiveName["V_MODEL"] = "v-model";
71
- /** Slot content insertion directives. */
160
+ /** Resize observer directives. */
72
161
  StandardDirectiveName["V_RESIZE"] = "v-resize";
73
162
  /** Intersection observer directives. */
74
163
  StandardDirectiveName["V_INTERSECTION"] = "v-intersection";
164
+ /** Performance observer directives. */
165
+ StandardDirectiveName["V_PERFORMANCE"] = "v-performance";
166
+ /** Component directive. */
167
+ StandardDirectiveName["V_COMPONENT"] = "v-component";
75
168
  })(StandardDirectiveName || (StandardDirectiveName = {}));
76
169
 
77
170
  // This file was generated. Do not modify manually!
@@ -6638,10 +6731,16 @@ class ExpressionUtils {
6638
6731
  const isArrowFunction = /^\s*(\([^)]*\)|[a-zA-Z_$][a-zA-Z0-9_$]*)\s*=>/.test(source);
6639
6732
  const isFunctionExpression = source.startsWith('function');
6640
6733
  const isAsyncFunction = source.startsWith('async');
6641
- // If it's a method shorthand (e.g., "methodName() { ... }"), convert to function expression
6642
- if (!isFunctionExpression && !isArrowFunction && !isAsyncFunction) {
6734
+ // If it's a method shorthand (e.g., "methodName() { ... }" or "async methodName() { ... }"), convert to function expression
6735
+ if (!isFunctionExpression && !isArrowFunction) {
6643
6736
  // It's likely a method shorthand, convert to function expression
6644
- source = `function ${source}`;
6737
+ if (isAsyncFunction) {
6738
+ // Remove 'async' prefix and add 'async function' prefix
6739
+ source = `async function ${source.substring(5).trim()}`;
6740
+ }
6741
+ else {
6742
+ source = `function ${source}`;
6743
+ }
6645
6744
  }
6646
6745
  // Wrap in parentheses for parsing
6647
6746
  source = `(${source})`;
@@ -7109,6 +7208,226 @@ class VBindDirective {
7109
7208
  }
7110
7209
  }
7111
7210
 
7211
+ // Copyright (c) 2025 MintJams Inc. Licensed under MIT License.
7212
+ /**
7213
+ * Directive for rendering components.
7214
+ * Usage: <div v-component="componentId" :options="props"></div>
7215
+ *
7216
+ * The :options binding is used to pass properties to the component.
7217
+ * Example:
7218
+ * <div v-component="my-component" :options="{message: 'Hello'}"></div>
7219
+ */
7220
+ class VComponentDirective {
7221
+ /**
7222
+ * The virtual node to which this directive is applied.
7223
+ */
7224
+ #vNode;
7225
+ /**
7226
+ * The component ID expression.
7227
+ */
7228
+ #expression;
7229
+ /**
7230
+ * Whether the component ID is static (not reactive).
7231
+ */
7232
+ #isStatic = false;
7233
+ /**
7234
+ * The component ID to render.
7235
+ */
7236
+ #componentId;
7237
+ /**
7238
+ * The child application instance for the component.
7239
+ */
7240
+ #childApp;
7241
+ /**
7242
+ * Whether the component has been activated.
7243
+ */
7244
+ #isActivated = false;
7245
+ constructor(context) {
7246
+ this.#vNode = context.vNode;
7247
+ this.#expression = context.attribute.value;
7248
+ // Check for .static modifier
7249
+ const attrName = context.attribute.name;
7250
+ this.#isStatic = attrName.includes('.static');
7251
+ // Remove the directive attribute from the element
7252
+ this.#vNode.node.removeAttribute(context.attribute.name);
7253
+ }
7254
+ /**
7255
+ * @inheritdoc
7256
+ */
7257
+ get name() {
7258
+ return StandardDirectiveName.V_COMPONENT;
7259
+ }
7260
+ /**
7261
+ * @inheritdoc
7262
+ */
7263
+ get vNode() {
7264
+ return this.#vNode;
7265
+ }
7266
+ /**
7267
+ * @inheritdoc
7268
+ */
7269
+ get needsAnchor() {
7270
+ return false;
7271
+ }
7272
+ /**
7273
+ * @inheritdoc
7274
+ */
7275
+ get bindingsPreparer() {
7276
+ return undefined;
7277
+ }
7278
+ /**
7279
+ * @inheritdoc
7280
+ */
7281
+ get domUpdater() {
7282
+ // Component rendering is handled through onMounted lifecycle hook
7283
+ return undefined;
7284
+ }
7285
+ /**
7286
+ * @inheritdoc
7287
+ */
7288
+ get templatize() {
7289
+ return false;
7290
+ }
7291
+ /**
7292
+ * @inheritdoc
7293
+ */
7294
+ get dependentIdentifiers() {
7295
+ return [];
7296
+ }
7297
+ /**
7298
+ * @inheritdoc
7299
+ */
7300
+ get onMount() {
7301
+ return () => {
7302
+ this.renderComponent();
7303
+ };
7304
+ }
7305
+ /**
7306
+ * @inheritdoc
7307
+ */
7308
+ get onMounted() {
7309
+ return undefined;
7310
+ }
7311
+ /**
7312
+ * @inheritdoc
7313
+ */
7314
+ get onUpdate() {
7315
+ return undefined;
7316
+ }
7317
+ /**
7318
+ * @inheritdoc
7319
+ */
7320
+ get onUpdated() {
7321
+ return undefined;
7322
+ }
7323
+ /**
7324
+ * @inheritdoc
7325
+ */
7326
+ get onUnmount() {
7327
+ return () => this.cleanupComponent();
7328
+ }
7329
+ /**
7330
+ * @inheritdoc
7331
+ */
7332
+ get onUnmounted() {
7333
+ return undefined;
7334
+ }
7335
+ /**
7336
+ * @inheritdoc
7337
+ */
7338
+ destroy() {
7339
+ this.cleanupComponent();
7340
+ }
7341
+ /**
7342
+ * Renders the component.
7343
+ */
7344
+ renderComponent() {
7345
+ const element = this.#vNode.node;
7346
+ if (!element) {
7347
+ return;
7348
+ }
7349
+ // For now, only support static component IDs
7350
+ const componentId = this.#expression.trim();
7351
+ if (!componentId) {
7352
+ console.warn(`Component ID is empty for v-component directive`);
7353
+ return;
7354
+ }
7355
+ // Get properties from :options or :options.component directive
7356
+ let properties = {};
7357
+ const optionsDirective = this.#vNode.directiveManager?.optionsDirective('component');
7358
+ if (optionsDirective && optionsDirective.expression) {
7359
+ // Evaluate the options expression
7360
+ const identifiers = optionsDirective.dependentIdentifiers;
7361
+ const values = identifiers.map(id => this.#vNode.bindings?.get(id));
7362
+ const args = identifiers.join(", ");
7363
+ const funcBody = `return (${optionsDirective.expression});`;
7364
+ const func = new Function(args, funcBody);
7365
+ const result = func(...values);
7366
+ if (typeof result === 'object' && result !== null) {
7367
+ properties = result;
7368
+ }
7369
+ }
7370
+ // Store component ID
7371
+ this.#componentId = componentId;
7372
+ // Get component definition from the application's component registry
7373
+ const vApplication = this.#vNode.vApplication;
7374
+ if (!vApplication) {
7375
+ console.error('VApplication not found on VNode');
7376
+ return;
7377
+ }
7378
+ const component = vApplication.componentRegistry.get(componentId);
7379
+ if (!component) {
7380
+ console.error(`Component '${componentId}' not found in registry`);
7381
+ return;
7382
+ }
7383
+ // Get template element
7384
+ const finalTemplateID = component.templateID;
7385
+ const templateElement = document.querySelector(`#${finalTemplateID}`);
7386
+ if (!templateElement || !(templateElement instanceof HTMLTemplateElement)) {
7387
+ console.error(`Template element '#${finalTemplateID}' not found`);
7388
+ return;
7389
+ }
7390
+ // Clone template content
7391
+ const fragment = templateElement.content.cloneNode(true);
7392
+ const childNodes = Array.from(fragment.childNodes);
7393
+ // Find the first element node
7394
+ let componentElement;
7395
+ for (const node of childNodes) {
7396
+ if (node.nodeType === Node.ELEMENT_NODE) {
7397
+ componentElement = node;
7398
+ break;
7399
+ }
7400
+ }
7401
+ if (!componentElement) {
7402
+ console.error(`No element found in template '#${finalTemplateID}'`);
7403
+ return;
7404
+ }
7405
+ // Replace element with component element
7406
+ const parent = element.parentNode;
7407
+ if (parent) {
7408
+ parent.insertBefore(componentElement, element);
7409
+ parent.removeChild(element);
7410
+ }
7411
+ // Create component instance
7412
+ const instance = component.createInstance(properties);
7413
+ // Create and mount child application using the parent application's registries
7414
+ this.#childApp = vApplication.createChildApp(instance);
7415
+ this.#childApp.mount(componentElement);
7416
+ this.#isActivated = true;
7417
+ }
7418
+ /**
7419
+ * Cleans up the component.
7420
+ */
7421
+ cleanupComponent() {
7422
+ if (this.#childApp) {
7423
+ // TODO: Implement unmount when available in VApplication
7424
+ // this.#childApp.unmount();
7425
+ this.#childApp = undefined;
7426
+ }
7427
+ this.#isActivated = false;
7428
+ }
7429
+ }
7430
+
7112
7431
  // Copyright (c) 2025 MintJams Inc. Licensed under MIT License.
7113
7432
  /**
7114
7433
  * Utility class for creating reactive proxies that automatically track changes.
@@ -7587,7 +7906,11 @@ class VDirectiveManager {
7587
7906
  }
7588
7907
  // If this is an options binding directive, cache it
7589
7908
  if (directive.name === StandardDirectiveName.V_BIND && directive.isOptions) {
7590
- this.#optionsDirectives[directive.name] = directive;
7909
+ const bindDirective = directive;
7910
+ const attrName = bindDirective.attributeName;
7911
+ if (attrName) {
7912
+ this.#optionsDirectives[attrName] = bindDirective;
7913
+ }
7591
7914
  }
7592
7915
  }
7593
7916
  }
@@ -9921,6 +10244,220 @@ class VOnDirective {
9921
10244
  }
9922
10245
  }
9923
10246
 
10247
+ // Copyright (c) 2025 MintJams Inc. Licensed under MIT License.
10248
+ /**
10249
+ * Directive for observing performance metrics using PerformanceObserver.
10250
+ * The `v-performance` directive allows you to monitor various performance entries.
10251
+ *
10252
+ * Example usage:
10253
+ * <div v-performance="handlePerformance">Performance monitoring</div>
10254
+ * <div v-performance="handlePerformance" :options.performance="{entryTypes: ['measure']}">Performance monitoring</div>
10255
+ *
10256
+ * By default (without options), it observes 'mark' and 'measure' entry types.
10257
+ *
10258
+ * The handler receives PerformanceObserverEntryList, PerformanceObserver, options (with droppedEntriesCount), and $ctx as arguments:
10259
+ * handlePerformance(entries, observer, options, $ctx) {
10260
+ * entries.getEntries().forEach(entry => {
10261
+ * console.log(`${entry.name}: ${entry.duration}ms`);
10262
+ * });
10263
+ * if (options?.droppedEntriesCount) {
10264
+ * console.log(`Dropped entries: ${options.droppedEntriesCount}`);
10265
+ * }
10266
+ * }
10267
+ *
10268
+ * Options can be provided via :options or :options.performance attribute:
10269
+ * :options="{entryTypes: ['measure', 'mark']}"
10270
+ * :options.performance="{type: 'navigation', buffered: true}"
10271
+ *
10272
+ * This directive is useful for performance monitoring, profiling, and identifying
10273
+ * performance bottlenecks in your application.
10274
+ */
10275
+ class VPerformanceDirective {
10276
+ /**
10277
+ * The virtual node to which this directive is applied.
10278
+ */
10279
+ #vNode;
10280
+ /**
10281
+ * A list of variable and function names used in the directive's expression.
10282
+ */
10283
+ #dependentIdentifiers;
10284
+ /**
10285
+ * The performance handler wrapper function.
10286
+ */
10287
+ #handlerWrapper;
10288
+ /**
10289
+ * The PerformanceObserver instance.
10290
+ */
10291
+ #performanceObserver;
10292
+ /**
10293
+ * @param context The context for parsing the directive.
10294
+ */
10295
+ constructor(context) {
10296
+ this.#vNode = context.vNode;
10297
+ // Parse the expression to extract identifiers and create the handler wrapper
10298
+ const expression = context.attribute.value;
10299
+ if (expression) {
10300
+ this.#dependentIdentifiers = ExpressionUtils.extractIdentifiers(expression, context.vNode.vApplication.functionDependencies);
10301
+ this.#handlerWrapper = this.#createPerformanceHandlerWrapper(expression);
10302
+ }
10303
+ // Remove the directive attribute from the element
10304
+ this.#vNode.node.removeAttribute(context.attribute.name);
10305
+ }
10306
+ /**
10307
+ * @inheritdoc
10308
+ */
10309
+ get name() {
10310
+ return StandardDirectiveName.V_PERFORMANCE;
10311
+ }
10312
+ /**
10313
+ * @inheritdoc
10314
+ */
10315
+ get vNode() {
10316
+ return this.#vNode;
10317
+ }
10318
+ /**
10319
+ * @inheritdoc
10320
+ */
10321
+ get needsAnchor() {
10322
+ return false;
10323
+ }
10324
+ /**
10325
+ * @inheritdoc
10326
+ */
10327
+ get bindingsPreparer() {
10328
+ return undefined;
10329
+ }
10330
+ /**
10331
+ * @inheritdoc
10332
+ */
10333
+ get domUpdater() {
10334
+ return undefined;
10335
+ }
10336
+ /**
10337
+ * @inheritdoc
10338
+ */
10339
+ get templatize() {
10340
+ return false;
10341
+ }
10342
+ /**
10343
+ * @inheritdoc
10344
+ */
10345
+ get dependentIdentifiers() {
10346
+ return this.#dependentIdentifiers ?? [];
10347
+ }
10348
+ /**
10349
+ * @inheritdoc
10350
+ */
10351
+ get onMount() {
10352
+ return undefined;
10353
+ }
10354
+ /**
10355
+ * @inheritdoc
10356
+ */
10357
+ get onMounted() {
10358
+ if (!this.#handlerWrapper) {
10359
+ return undefined;
10360
+ }
10361
+ const handler = this.#handlerWrapper;
10362
+ return () => {
10363
+ // Get options from :options.performance or :options directive
10364
+ let optionsDirective = this.#vNode.directiveManager?.optionsDirective('performance');
10365
+ // Evaluate the options expression
10366
+ let options;
10367
+ if (optionsDirective && optionsDirective.expression) {
10368
+ // Evaluate the options expression
10369
+ const identifiers = optionsDirective.dependentIdentifiers;
10370
+ const values = identifiers.map(id => this.#vNode.bindings?.get(id));
10371
+ const args = identifiers.join(", ");
10372
+ const funcBody = `return (${optionsDirective.expression});`;
10373
+ const func = new Function(args, funcBody);
10374
+ options = func(...values);
10375
+ }
10376
+ // Create PerformanceObserver and start observing
10377
+ // Note: The callback receives a third argument 'options' with droppedEntriesCount in modern browsers
10378
+ // TypeScript's type definition only includes 2 arguments, so we use type assertion
10379
+ this.#performanceObserver = new PerformanceObserver(((...args) => {
10380
+ const [entries, observer, callbackOptions] = args;
10381
+ handler(entries, observer, callbackOptions);
10382
+ }));
10383
+ // If no options provided, use default: observe marks and measures
10384
+ if (!options) {
10385
+ options = { entryTypes: ['mark', 'measure'] };
10386
+ }
10387
+ // Start observing with options
10388
+ this.#performanceObserver.observe(options);
10389
+ };
10390
+ }
10391
+ /**
10392
+ * @inheritdoc
10393
+ */
10394
+ get onUpdate() {
10395
+ return undefined;
10396
+ }
10397
+ /**
10398
+ * @inheritdoc
10399
+ */
10400
+ get onUpdated() {
10401
+ return undefined;
10402
+ }
10403
+ /**
10404
+ * @inheritdoc
10405
+ */
10406
+ get onUnmount() {
10407
+ return undefined;
10408
+ }
10409
+ /**
10410
+ * @inheritdoc
10411
+ */
10412
+ get onUnmounted() {
10413
+ return undefined;
10414
+ }
10415
+ /**
10416
+ * @inheritdoc
10417
+ */
10418
+ destroy() {
10419
+ // Disconnect the PerformanceObserver when the directive is destroyed
10420
+ if (this.#performanceObserver) {
10421
+ this.#performanceObserver.disconnect();
10422
+ this.#performanceObserver = undefined;
10423
+ }
10424
+ }
10425
+ /**
10426
+ * Creates a wrapper function for performance handlers.
10427
+ * @param expression The expression string to evaluate.
10428
+ * @returns A function that handles the performance event.
10429
+ */
10430
+ #createPerformanceHandlerWrapper(expression) {
10431
+ const identifiers = this.#dependentIdentifiers ?? [];
10432
+ const vNode = this.#vNode;
10433
+ // Return a function that handles the performance event with proper scope
10434
+ return (entries, observer, options) => {
10435
+ const bindings = vNode.bindings;
10436
+ const $ctx = {
10437
+ element: vNode.node,
10438
+ vnode: vNode,
10439
+ userData: vNode.userData
10440
+ };
10441
+ // If the expression is just a method name, call it with bindings as 'this'
10442
+ const trimmedExpr = expression.trim();
10443
+ if (identifiers.includes(trimmedExpr) && typeof bindings?.get(trimmedExpr) === 'function') {
10444
+ const methodName = trimmedExpr;
10445
+ const originalMethod = bindings?.get(methodName);
10446
+ // Call the method with bindings as 'this' context
10447
+ // Pass entries, observer, options, and $ctx as arguments
10448
+ return originalMethod(entries, observer, options, $ctx);
10449
+ }
10450
+ // For inline expressions, evaluate normally
10451
+ // Note: inline expressions receive entries, observer, options, and $ctx as parameters
10452
+ const values = identifiers.map(id => vNode.bindings?.get(id));
10453
+ const args = [...identifiers, 'entries', 'observer', 'options', '$ctx'].join(", ");
10454
+ const funcBody = `return (${expression});`;
10455
+ const func = new Function(args, funcBody);
10456
+ return func.call(bindings?.raw, ...values, entries, observer, options, $ctx);
10457
+ };
10458
+ }
10459
+ }
10460
+
9924
10461
  // Copyright (c) 2025 MintJams Inc. Licensed under MIT License.
9925
10462
  /**
9926
10463
  * Directive for observing element resize events using ResizeObserver.
@@ -10351,7 +10888,12 @@ class VStandardDirectiveParser {
10351
10888
  // v-resize
10352
10889
  context.attribute.name === StandardDirectiveName.V_RESIZE ||
10353
10890
  // v-intersection
10354
- context.attribute.name === StandardDirectiveName.V_INTERSECTION) {
10891
+ context.attribute.name === StandardDirectiveName.V_INTERSECTION ||
10892
+ // v-performance
10893
+ context.attribute.name === StandardDirectiveName.V_PERFORMANCE ||
10894
+ // v-component, v-component.<modifier>
10895
+ context.attribute.name === StandardDirectiveName.V_COMPONENT ||
10896
+ context.attribute.name.startsWith(StandardDirectiveName.V_COMPONENT + ".")) {
10355
10897
  return true;
10356
10898
  }
10357
10899
  return false;
@@ -10398,6 +10940,15 @@ class VStandardDirectiveParser {
10398
10940
  if (context.attribute.name === StandardDirectiveName.V_INTERSECTION) {
10399
10941
  return new VIntersectionDirective(context);
10400
10942
  }
10943
+ // v-performance
10944
+ if (context.attribute.name === StandardDirectiveName.V_PERFORMANCE) {
10945
+ return new VPerformanceDirective(context);
10946
+ }
10947
+ // v-component, v-component.<modifier>
10948
+ if (context.attribute.name === StandardDirectiveName.V_COMPONENT ||
10949
+ context.attribute.name.startsWith(StandardDirectiveName.V_COMPONENT + ".")) {
10950
+ return new VComponentDirective(context);
10951
+ }
10401
10952
  throw new Error(`The attribute "${context.attribute.name}" cannot be parsed by ${this.name}.`);
10402
10953
  }
10403
10954
  }
@@ -10631,12 +11182,18 @@ class VApplication {
10631
11182
  }
10632
11183
  /**
10633
11184
  * Mounts the application.
10634
- * @param selectors The CSS selectors to identify the root element.
10635
- */
10636
- mount(selectors) {
10637
- const element = document.querySelector(selectors);
10638
- if (!element) {
10639
- throw new Error(`Element not found for selectors: ${selectors}`);
11185
+ * @param target The CSS selector string or HTMLElement to mount the application to.
11186
+ */
11187
+ mount(target) {
11188
+ let element;
11189
+ if (typeof target === 'string') {
11190
+ element = document.querySelector(target);
11191
+ if (!element) {
11192
+ throw new Error(`Element not found for selector: ${target}`);
11193
+ }
11194
+ }
11195
+ else {
11196
+ element = target;
10640
11197
  }
10641
11198
  // Clean the element by removing unnecessary whitespace text nodes
10642
11199
  this.#cleanElement(element);
@@ -10650,6 +11207,14 @@ class VApplication {
10650
11207
  this.#vNode.update();
10651
11208
  this.#logger.info('Application mounted.');
10652
11209
  }
11210
+ /**
11211
+ * Creates a child application instance with the same registries.
11212
+ * @param options The application options for the child.
11213
+ * @returns The created child application instance.
11214
+ */
11215
+ createChildApp(options) {
11216
+ return new VApplication(options, this.#directiveParserRegistry, this.#componentRegistry);
11217
+ }
10653
11218
  /**
10654
11219
  * Cleans the element by removing unnecessary whitespace text nodes.
10655
11220
  * @param element The element to clean.
@@ -10886,5 +11451,5 @@ class VDOM {
10886
11451
  }
10887
11452
  }
10888
11453
 
10889
- export { VDOM };
11454
+ export { VComponent, VComponentRegistry, VDOM };
10890
11455
  //# sourceMappingURL=ichigo.esm.js.map