@coherent.js/core 1.0.0-beta.7 → 1.0.0-beta.8

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/dist/index.cjs CHANGED
@@ -98,7 +98,6 @@ __export(index_exports, {
98
98
  withStateUtils: () => withStateUtils
99
99
  });
100
100
  module.exports = __toCommonJS(index_exports);
101
- var import_node_fs = require("node:fs");
102
101
 
103
102
  // src/performance/monitor.js
104
103
  function createPerformanceMonitor(options = {}) {
@@ -551,6 +550,23 @@ function createPerformanceMonitor(options = {}) {
551
550
  startReporting();
552
551
  startProfiling();
553
552
  }
553
+ let _renderCounter = 0;
554
+ const _renderTimers = /* @__PURE__ */ new Map();
555
+ function startRender() {
556
+ const id = `render_${++_renderCounter}`;
557
+ _renderTimers.set(id, performance.now());
558
+ return id;
559
+ }
560
+ function endRender(id) {
561
+ const startTime = _renderTimers.get(id);
562
+ if (startTime !== void 0) {
563
+ const duration = performance.now() - startTime;
564
+ _renderTimers.delete(id);
565
+ recordMetric("render", duration);
566
+ return duration;
567
+ }
568
+ return 0;
569
+ }
554
570
  return {
555
571
  recordMetric,
556
572
  measure,
@@ -560,6 +576,8 @@ function createPerformanceMonitor(options = {}) {
560
576
  generateReport,
561
577
  getStats,
562
578
  reset,
579
+ startRender,
580
+ endRender,
563
581
  start() {
564
582
  opts.enabled = true;
565
583
  startResourceMonitoring();
@@ -2172,6 +2190,11 @@ var HTMLRenderer = class extends BaseRenderer {
2172
2190
  const { children, text, key: _key, html: _rawHtml, ...attributes } = element || {};
2173
2191
  const attributeString = formatAttributes(attributes);
2174
2192
  const openingTag = attributeString ? `<${tagName} ${attributeString}>` : `<${tagName}>`;
2193
+ if (_rawHtml !== void 0) {
2194
+ const rawContent = typeof _rawHtml === "function" ? String(_rawHtml()) : String(_rawHtml);
2195
+ const result = `${openingTag}${rawContent}</${tagName}>`;
2196
+ return result;
2197
+ }
2175
2198
  let textContent = "";
2176
2199
  if (text !== void 0) {
2177
2200
  const isScript = tagName === "script";
@@ -5101,7 +5124,7 @@ var EventBus = class {
5101
5124
  }
5102
5125
  }
5103
5126
  /**
5104
- * Emit with throttling
5127
+ * Emit throttled event
5105
5128
  */
5106
5129
  emitThrottled(event, data, delay) {
5107
5130
  if (!this.throttledEmitters.has(event)) {
@@ -5125,7 +5148,7 @@ var EventBus = class {
5125
5148
  }
5126
5149
  }
5127
5150
  /**
5128
- * Flush batch queue
5151
+ * Flush batched events
5129
5152
  */
5130
5153
  async flushBatch() {
5131
5154
  if (this.batchTimer) {
@@ -5263,7 +5286,7 @@ var EventBus = class {
5263
5286
  }
5264
5287
  }
5265
5288
  /**
5266
- * Run middleware chain
5289
+ * Run middleware
5267
5290
  */
5268
5291
  async runMiddleware(event, data) {
5269
5292
  if (this.middleware.length === 0) return;
@@ -5463,7 +5486,6 @@ var DOMEventIntegration = class {
5463
5486
  }
5464
5487
  /**
5465
5488
  * Set up delegated DOM event listeners
5466
- * @private
5467
5489
  */
5468
5490
  setupDOMEventListeners() {
5469
5491
  const clickHandler = this.createDelegatedHandler("click", this.handleClick);
@@ -5490,7 +5512,6 @@ var DOMEventIntegration = class {
5490
5512
  }
5491
5513
  /**
5492
5514
  * Create a delegated event handler
5493
- * @private
5494
5515
  */
5495
5516
  createDelegatedHandler(eventType, handler) {
5496
5517
  return (event) => {
@@ -5506,7 +5527,6 @@ var DOMEventIntegration = class {
5506
5527
  }
5507
5528
  /**
5508
5529
  * Handle click events
5509
- * @private
5510
5530
  */
5511
5531
  handleClick(element, event) {
5512
5532
  const action = element.getAttribute?.("data-action");
@@ -5522,7 +5542,6 @@ var DOMEventIntegration = class {
5522
5542
  }
5523
5543
  /**
5524
5544
  * Handle change events
5525
- * @private
5526
5545
  */
5527
5546
  handleChange(element, event) {
5528
5547
  const action = element.getAttribute?.("data-action");
@@ -5539,7 +5558,6 @@ var DOMEventIntegration = class {
5539
5558
  }
5540
5559
  /**
5541
5560
  * Handle input events
5542
- * @private
5543
5561
  */
5544
5562
  handleInput(element, event) {
5545
5563
  const action = element.getAttribute?.("data-action");
@@ -5556,7 +5574,6 @@ var DOMEventIntegration = class {
5556
5574
  }
5557
5575
  /**
5558
5576
  * Handle submit events
5559
- * @private
5560
5577
  */
5561
5578
  handleSubmit(element, event) {
5562
5579
  const action = element.getAttribute?.("data-action");
@@ -5574,7 +5591,6 @@ var DOMEventIntegration = class {
5574
5591
  }
5575
5592
  /**
5576
5593
  * Handle keydown events
5577
- * @private
5578
5594
  */
5579
5595
  handleKeydown(element, event) {
5580
5596
  const action = element.getAttribute?.("data-action");
@@ -5597,7 +5613,6 @@ var DOMEventIntegration = class {
5597
5613
  }
5598
5614
  /**
5599
5615
  * Handle focus events
5600
- * @private
5601
5616
  */
5602
5617
  handleFocus(element, event) {
5603
5618
  this.activeElement = element;
@@ -5609,7 +5624,6 @@ var DOMEventIntegration = class {
5609
5624
  }
5610
5625
  /**
5611
5626
  * Handle blur events
5612
- * @private
5613
5627
  */
5614
5628
  handleBlur(element, event) {
5615
5629
  if (this.activeElement === element) {
@@ -5623,7 +5637,6 @@ var DOMEventIntegration = class {
5623
5637
  }
5624
5638
  /**
5625
5639
  * Handle data-action attributes
5626
- * @private
5627
5640
  */
5628
5641
  handleDataAction(element, event, action) {
5629
5642
  if (!action) return;
@@ -5645,7 +5658,6 @@ var DOMEventIntegration = class {
5645
5658
  }
5646
5659
  /**
5647
5660
  * Parse data attributes from an element
5648
- * @private
5649
5661
  */
5650
5662
  parseDataAttributes(element) {
5651
5663
  if (!element?.attributes) return {};
@@ -5673,7 +5685,6 @@ var DOMEventIntegration = class {
5673
5685
  }
5674
5686
  /**
5675
5687
  * Extract form data from a form element
5676
- * @private
5677
5688
  */
5678
5689
  extractFormData(formElement) {
5679
5690
  if (!formElement || formElement.tagName !== "FORM") {
@@ -5696,7 +5707,6 @@ var DOMEventIntegration = class {
5696
5707
  }
5697
5708
  /**
5698
5709
  * Check if a key event should trigger an action
5699
- * @private
5700
5710
  */
5701
5711
  shouldTriggerKeyAction(event) {
5702
5712
  const triggerKeys = ["Enter", "Space", "Escape"];
@@ -5704,7 +5714,6 @@ var DOMEventIntegration = class {
5704
5714
  }
5705
5715
  /**
5706
5716
  * Debounce utility function
5707
- * @private
5708
5717
  */
5709
5718
  debounce(func, wait) {
5710
5719
  let timeout;
@@ -5719,7 +5728,6 @@ var DOMEventIntegration = class {
5719
5728
  }
5720
5729
  /**
5721
5730
  * Throttle utility function
5722
- * @private
5723
5731
  */
5724
5732
  throttle(func, limit) {
5725
5733
  let inThrottle;
@@ -6326,7 +6334,6 @@ var compose = {
6326
6334
  };
6327
6335
 
6328
6336
  // src/index.js
6329
- var import_meta = {};
6330
6337
  var scopeCounter = { value: 0 };
6331
6338
  function generateScopeId() {
6332
6339
  return `coh-${scopeCounter.value++}`;
@@ -6489,10 +6496,7 @@ function deepClone2(obj) {
6489
6496
  }
6490
6497
  return cloned;
6491
6498
  }
6492
- var _corePackageJson = JSON.parse(
6493
- (0, import_node_fs.readFileSync)(new URL("../package.json", import_meta.url), "utf-8")
6494
- );
6495
- var VERSION = _corePackageJson.version;
6499
+ var VERSION = "1.0.0-beta.8";
6496
6500
  var fp = {
6497
6501
  /**
6498
6502
  * Curried map: fp.map(fn)(array)
@@ -6650,7 +6654,7 @@ var index_default = coherent;
6650
6654
  * Coherent.js - Object-Based Rendering Framework
6651
6655
  * A pure JavaScript framework for server-side rendering using natural object syntax
6652
6656
  *
6653
- * @version 1.0.0-beta.7
6657
+ * @version 1.0.0-beta.8
6654
6658
  * @author Coherent Framework Team
6655
6659
  * @license MIT
6656
6660
  */