@coherent.js/core 1.0.0-beta.6 → 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/coherent.d.ts +150 -10
- package/dist/coherent.d.ts.map +1 -1
- package/dist/coherent.js +166 -33
- package/dist/coherent.js.map +1 -1
- package/dist/components/component-system.js +109 -109
- package/dist/components/lifecycle.d.ts +212 -0
- package/dist/components/lifecycle.d.ts.map +1 -0
- package/dist/components/lifecycle.js +525 -0
- package/dist/components/lifecycle.js.map +1 -0
- package/dist/core/html-utils.js +5 -5
- package/dist/core/object-factory.js +21 -21
- package/dist/core/object-utils.js +2 -2
- package/dist/dev/dev-tools.d.ts +1 -1
- package/dist/dev/dev-tools.js +28 -28
- package/dist/forms/validation.d.ts +271 -0
- package/dist/forms/validation.d.ts.map +1 -0
- package/dist/forms/validation.js +573 -0
- package/dist/forms/validation.js.map +1 -0
- package/dist/index.cjs +185 -28
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +181 -29
- package/dist/index.js.map +4 -4
- package/dist/performance/bundle-optimizer.js +11 -11
- package/dist/performance/cache-manager.js +6 -6
- package/dist/performance/component-cache.d.ts +120 -0
- package/dist/performance/component-cache.d.ts.map +1 -0
- package/dist/performance/component-cache.js +364 -0
- package/dist/performance/component-cache.js.map +1 -0
- package/dist/performance/monitor.js +10 -10
- package/dist/performance/monitor.js.map +1 -1
- package/dist/rendering/base-renderer.js +13 -13
- package/dist/rendering/css-manager.d.ts +73 -0
- package/dist/rendering/css-manager.d.ts.map +1 -0
- package/dist/rendering/css-manager.js +176 -0
- package/dist/rendering/css-manager.js.map +1 -0
- package/dist/rendering/dom-renderer.d.ts +23 -0
- package/dist/rendering/dom-renderer.d.ts.map +1 -1
- package/dist/rendering/dom-renderer.js +77 -9
- package/dist/rendering/dom-renderer.js.map +1 -1
- package/dist/rendering/html-renderer.d.ts +15 -0
- package/dist/rendering/html-renderer.d.ts.map +1 -1
- package/dist/rendering/html-renderer.js +85 -4
- package/dist/rendering/html-renderer.js.map +1 -1
- package/dist/rendering/streaming-renderer.js +12 -12
- package/dist/rendering/vdom-diff.d.ts +47 -0
- package/dist/rendering/vdom-diff.d.ts.map +1 -0
- package/dist/rendering/vdom-diff.js +416 -0
- package/dist/rendering/vdom-diff.js.map +1 -0
- package/dist/routing/router.d.ts +241 -0
- package/dist/routing/router.d.ts.map +1 -0
- package/dist/routing/router.js +648 -0
- package/dist/routing/router.js.map +1 -0
- package/dist/state/reactive-state.d.ts +166 -0
- package/dist/state/reactive-state.d.ts.map +1 -0
- package/dist/state/reactive-state.js +546 -0
- package/dist/state/reactive-state.js.map +1 -0
- package/dist/utils/dependency-utils.js +2 -2
- package/dist/utils/error-handler.d.ts +148 -0
- package/dist/utils/error-handler.d.ts.map +1 -0
- package/dist/utils/error-handler.js +468 -0
- package/dist/utils/error-handler.js.map +1 -0
- package/dist/utils/normalization.js +1 -1
- package/dist/utils/validation.js +1 -1
- package/package.json +5 -1
- package/dist/database/adapters/mongodb.d.ts +0 -15
- package/dist/database/adapters/mongodb.d.ts.map +0 -1
- package/dist/database/adapters/mongodb.js +0 -216
- package/dist/database/adapters/mongodb.js.map +0 -1
- package/dist/database/adapters/mysql.d.ts +0 -12
- package/dist/database/adapters/mysql.d.ts.map +0 -1
- package/dist/database/adapters/mysql.js +0 -171
- package/dist/database/adapters/mysql.js.map +0 -1
- package/dist/database/adapters/postgresql.d.ts +0 -12
- package/dist/database/adapters/postgresql.d.ts.map +0 -1
- package/dist/database/adapters/postgresql.js +0 -177
- package/dist/database/adapters/postgresql.js.map +0 -1
- package/dist/database/adapters/sqlite.d.ts +0 -15
- package/dist/database/adapters/sqlite.d.ts.map +0 -1
- package/dist/database/adapters/sqlite.js +0 -241
- package/dist/database/adapters/sqlite.js.map +0 -1
- package/dist/database/connection-manager.d.ts +0 -135
- package/dist/database/connection-manager.d.ts.map +0 -1
- package/dist/database/connection-manager.js +0 -362
- package/dist/database/connection-manager.js.map +0 -1
- package/dist/database/index.d.ts +0 -38
- package/dist/database/index.d.ts.map +0 -1
- package/dist/database/index.js +0 -60
- package/dist/database/index.js.map +0 -1
- package/dist/database/middleware.d.ts +0 -122
- package/dist/database/middleware.d.ts.map +0 -1
- package/dist/database/middleware.js +0 -390
- package/dist/database/middleware.js.map +0 -1
- package/dist/database/migration.d.ts +0 -62
- package/dist/database/migration.d.ts.map +0 -1
- package/dist/database/migration.js +0 -423
- package/dist/database/migration.js.map +0 -1
- package/dist/database/model.d.ts +0 -8
- package/dist/database/model.d.ts.map +0 -1
- package/dist/database/model.js +0 -167
- package/dist/database/model.js.map +0 -1
- package/dist/database/query-builder.d.ts +0 -111
- package/dist/database/query-builder.d.ts.map +0 -1
- package/dist/database/query-builder.js +0 -187
- package/dist/database/query-builder.js.map +0 -1
- package/dist/database/utils.d.ts +0 -196
- package/dist/database/utils.d.ts.map +0 -1
- package/dist/database/utils.js +0 -372
- package/dist/database/utils.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -10,9 +10,6 @@ var __export = (target, all) => {
|
|
|
10
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
// src/index.js
|
|
14
|
-
import { readFileSync } from "node:fs";
|
|
15
|
-
|
|
16
13
|
// src/performance/monitor.js
|
|
17
14
|
function createPerformanceMonitor(options = {}) {
|
|
18
15
|
const opts = {
|
|
@@ -464,6 +461,23 @@ function createPerformanceMonitor(options = {}) {
|
|
|
464
461
|
startReporting();
|
|
465
462
|
startProfiling();
|
|
466
463
|
}
|
|
464
|
+
let _renderCounter = 0;
|
|
465
|
+
const _renderTimers = /* @__PURE__ */ new Map();
|
|
466
|
+
function startRender() {
|
|
467
|
+
const id = `render_${++_renderCounter}`;
|
|
468
|
+
_renderTimers.set(id, performance.now());
|
|
469
|
+
return id;
|
|
470
|
+
}
|
|
471
|
+
function endRender(id) {
|
|
472
|
+
const startTime = _renderTimers.get(id);
|
|
473
|
+
if (startTime !== void 0) {
|
|
474
|
+
const duration = performance.now() - startTime;
|
|
475
|
+
_renderTimers.delete(id);
|
|
476
|
+
recordMetric("render", duration);
|
|
477
|
+
return duration;
|
|
478
|
+
}
|
|
479
|
+
return 0;
|
|
480
|
+
}
|
|
467
481
|
return {
|
|
468
482
|
recordMetric,
|
|
469
483
|
measure,
|
|
@@ -473,6 +487,8 @@ function createPerformanceMonitor(options = {}) {
|
|
|
473
487
|
generateReport,
|
|
474
488
|
getStats,
|
|
475
489
|
reset,
|
|
490
|
+
startRender,
|
|
491
|
+
endRender,
|
|
476
492
|
start() {
|
|
477
493
|
opts.enabled = true;
|
|
478
494
|
startResourceMonitoring();
|
|
@@ -1193,7 +1209,13 @@ function formatAttributes(props) {
|
|
|
1193
1209
|
}
|
|
1194
1210
|
}
|
|
1195
1211
|
}
|
|
1196
|
-
if (value ===
|
|
1212
|
+
if (attributeName === "style" && typeof value === "object" && value !== null) {
|
|
1213
|
+
const cssString = Object.entries(value).map(([prop, val]) => {
|
|
1214
|
+
const kebabProp = prop.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
|
|
1215
|
+
return `${kebabProp}: ${val}`;
|
|
1216
|
+
}).join("; ");
|
|
1217
|
+
formatted += ` ${attributeName}="${escapeHtml(cssString)}"`;
|
|
1218
|
+
} else if (value === true) {
|
|
1197
1219
|
formatted += ` ${attributeName}`;
|
|
1198
1220
|
} else if (value !== false && value !== null && value !== void 0) {
|
|
1199
1221
|
formatted += ` ${attributeName}="${escapeHtml(String(value))}"`;
|
|
@@ -1414,6 +1436,9 @@ function createCacheManager(options = {}) {
|
|
|
1414
1436
|
}
|
|
1415
1437
|
clear();
|
|
1416
1438
|
}
|
|
1439
|
+
function hashObject(obj) {
|
|
1440
|
+
return simpleHash(JSON.stringify(obj));
|
|
1441
|
+
}
|
|
1417
1442
|
return {
|
|
1418
1443
|
get,
|
|
1419
1444
|
set,
|
|
@@ -1423,6 +1448,7 @@ function createCacheManager(options = {}) {
|
|
|
1423
1448
|
cleanup,
|
|
1424
1449
|
destroy,
|
|
1425
1450
|
generateCacheKey,
|
|
1451
|
+
hashObject,
|
|
1426
1452
|
get memoryUsage() {
|
|
1427
1453
|
return memoryUsage;
|
|
1428
1454
|
},
|
|
@@ -2075,6 +2101,11 @@ var HTMLRenderer = class extends BaseRenderer {
|
|
|
2075
2101
|
const { children, text, key: _key, html: _rawHtml, ...attributes } = element || {};
|
|
2076
2102
|
const attributeString = formatAttributes(attributes);
|
|
2077
2103
|
const openingTag = attributeString ? `<${tagName} ${attributeString}>` : `<${tagName}>`;
|
|
2104
|
+
if (_rawHtml !== void 0) {
|
|
2105
|
+
const rawContent = typeof _rawHtml === "function" ? String(_rawHtml()) : String(_rawHtml);
|
|
2106
|
+
const result = `${openingTag}${rawContent}</${tagName}>`;
|
|
2107
|
+
return result;
|
|
2108
|
+
}
|
|
2078
2109
|
let textContent = "";
|
|
2079
2110
|
if (text !== void 0) {
|
|
2080
2111
|
const isScript = tagName === "script";
|
|
@@ -5004,7 +5035,7 @@ var EventBus = class {
|
|
|
5004
5035
|
}
|
|
5005
5036
|
}
|
|
5006
5037
|
/**
|
|
5007
|
-
* Emit
|
|
5038
|
+
* Emit throttled event
|
|
5008
5039
|
*/
|
|
5009
5040
|
emitThrottled(event, data, delay) {
|
|
5010
5041
|
if (!this.throttledEmitters.has(event)) {
|
|
@@ -5028,7 +5059,7 @@ var EventBus = class {
|
|
|
5028
5059
|
}
|
|
5029
5060
|
}
|
|
5030
5061
|
/**
|
|
5031
|
-
* Flush
|
|
5062
|
+
* Flush batched events
|
|
5032
5063
|
*/
|
|
5033
5064
|
async flushBatch() {
|
|
5034
5065
|
if (this.batchTimer) {
|
|
@@ -5166,7 +5197,7 @@ var EventBus = class {
|
|
|
5166
5197
|
}
|
|
5167
5198
|
}
|
|
5168
5199
|
/**
|
|
5169
|
-
* Run middleware
|
|
5200
|
+
* Run middleware
|
|
5170
5201
|
*/
|
|
5171
5202
|
async runMiddleware(event, data) {
|
|
5172
5203
|
if (this.middleware.length === 0) return;
|
|
@@ -5366,7 +5397,6 @@ var DOMEventIntegration = class {
|
|
|
5366
5397
|
}
|
|
5367
5398
|
/**
|
|
5368
5399
|
* Set up delegated DOM event listeners
|
|
5369
|
-
* @private
|
|
5370
5400
|
*/
|
|
5371
5401
|
setupDOMEventListeners() {
|
|
5372
5402
|
const clickHandler = this.createDelegatedHandler("click", this.handleClick);
|
|
@@ -5393,7 +5423,6 @@ var DOMEventIntegration = class {
|
|
|
5393
5423
|
}
|
|
5394
5424
|
/**
|
|
5395
5425
|
* Create a delegated event handler
|
|
5396
|
-
* @private
|
|
5397
5426
|
*/
|
|
5398
5427
|
createDelegatedHandler(eventType, handler) {
|
|
5399
5428
|
return (event) => {
|
|
@@ -5409,7 +5438,6 @@ var DOMEventIntegration = class {
|
|
|
5409
5438
|
}
|
|
5410
5439
|
/**
|
|
5411
5440
|
* Handle click events
|
|
5412
|
-
* @private
|
|
5413
5441
|
*/
|
|
5414
5442
|
handleClick(element, event) {
|
|
5415
5443
|
const action = element.getAttribute?.("data-action");
|
|
@@ -5425,7 +5453,6 @@ var DOMEventIntegration = class {
|
|
|
5425
5453
|
}
|
|
5426
5454
|
/**
|
|
5427
5455
|
* Handle change events
|
|
5428
|
-
* @private
|
|
5429
5456
|
*/
|
|
5430
5457
|
handleChange(element, event) {
|
|
5431
5458
|
const action = element.getAttribute?.("data-action");
|
|
@@ -5442,7 +5469,6 @@ var DOMEventIntegration = class {
|
|
|
5442
5469
|
}
|
|
5443
5470
|
/**
|
|
5444
5471
|
* Handle input events
|
|
5445
|
-
* @private
|
|
5446
5472
|
*/
|
|
5447
5473
|
handleInput(element, event) {
|
|
5448
5474
|
const action = element.getAttribute?.("data-action");
|
|
@@ -5459,7 +5485,6 @@ var DOMEventIntegration = class {
|
|
|
5459
5485
|
}
|
|
5460
5486
|
/**
|
|
5461
5487
|
* Handle submit events
|
|
5462
|
-
* @private
|
|
5463
5488
|
*/
|
|
5464
5489
|
handleSubmit(element, event) {
|
|
5465
5490
|
const action = element.getAttribute?.("data-action");
|
|
@@ -5477,7 +5502,6 @@ var DOMEventIntegration = class {
|
|
|
5477
5502
|
}
|
|
5478
5503
|
/**
|
|
5479
5504
|
* Handle keydown events
|
|
5480
|
-
* @private
|
|
5481
5505
|
*/
|
|
5482
5506
|
handleKeydown(element, event) {
|
|
5483
5507
|
const action = element.getAttribute?.("data-action");
|
|
@@ -5500,7 +5524,6 @@ var DOMEventIntegration = class {
|
|
|
5500
5524
|
}
|
|
5501
5525
|
/**
|
|
5502
5526
|
* Handle focus events
|
|
5503
|
-
* @private
|
|
5504
5527
|
*/
|
|
5505
5528
|
handleFocus(element, event) {
|
|
5506
5529
|
this.activeElement = element;
|
|
@@ -5512,7 +5535,6 @@ var DOMEventIntegration = class {
|
|
|
5512
5535
|
}
|
|
5513
5536
|
/**
|
|
5514
5537
|
* Handle blur events
|
|
5515
|
-
* @private
|
|
5516
5538
|
*/
|
|
5517
5539
|
handleBlur(element, event) {
|
|
5518
5540
|
if (this.activeElement === element) {
|
|
@@ -5526,7 +5548,6 @@ var DOMEventIntegration = class {
|
|
|
5526
5548
|
}
|
|
5527
5549
|
/**
|
|
5528
5550
|
* Handle data-action attributes
|
|
5529
|
-
* @private
|
|
5530
5551
|
*/
|
|
5531
5552
|
handleDataAction(element, event, action) {
|
|
5532
5553
|
if (!action) return;
|
|
@@ -5548,7 +5569,6 @@ var DOMEventIntegration = class {
|
|
|
5548
5569
|
}
|
|
5549
5570
|
/**
|
|
5550
5571
|
* Parse data attributes from an element
|
|
5551
|
-
* @private
|
|
5552
5572
|
*/
|
|
5553
5573
|
parseDataAttributes(element) {
|
|
5554
5574
|
if (!element?.attributes) return {};
|
|
@@ -5576,7 +5596,6 @@ var DOMEventIntegration = class {
|
|
|
5576
5596
|
}
|
|
5577
5597
|
/**
|
|
5578
5598
|
* Extract form data from a form element
|
|
5579
|
-
* @private
|
|
5580
5599
|
*/
|
|
5581
5600
|
extractFormData(formElement) {
|
|
5582
5601
|
if (!formElement || formElement.tagName !== "FORM") {
|
|
@@ -5599,7 +5618,6 @@ var DOMEventIntegration = class {
|
|
|
5599
5618
|
}
|
|
5600
5619
|
/**
|
|
5601
5620
|
* Check if a key event should trigger an action
|
|
5602
|
-
* @private
|
|
5603
5621
|
*/
|
|
5604
5622
|
shouldTriggerKeyAction(event) {
|
|
5605
5623
|
const triggerKeys = ["Enter", "Space", "Escape"];
|
|
@@ -5607,7 +5625,6 @@ var DOMEventIntegration = class {
|
|
|
5607
5625
|
}
|
|
5608
5626
|
/**
|
|
5609
5627
|
* Debounce utility function
|
|
5610
|
-
* @private
|
|
5611
5628
|
*/
|
|
5612
5629
|
debounce(func, wait) {
|
|
5613
5630
|
let timeout;
|
|
@@ -5622,7 +5639,6 @@ var DOMEventIntegration = class {
|
|
|
5622
5639
|
}
|
|
5623
5640
|
/**
|
|
5624
5641
|
* Throttle utility function
|
|
5625
|
-
* @private
|
|
5626
5642
|
*/
|
|
5627
5643
|
throttle(func, limit) {
|
|
5628
5644
|
let inThrottle;
|
|
@@ -6137,6 +6153,97 @@ var eventSystem2 = {
|
|
|
6137
6153
|
};
|
|
6138
6154
|
var events_default = eventSystem2;
|
|
6139
6155
|
|
|
6156
|
+
// src/components/enhanced-composition.js
|
|
6157
|
+
var hoc = {
|
|
6158
|
+
/**
|
|
6159
|
+
* Wrap component with additional props
|
|
6160
|
+
*/
|
|
6161
|
+
withProps(additionalProps) {
|
|
6162
|
+
return (Component2) => (props) => {
|
|
6163
|
+
return Component2({ ...props, ...additionalProps });
|
|
6164
|
+
};
|
|
6165
|
+
},
|
|
6166
|
+
/**
|
|
6167
|
+
* Conditional rendering HOC
|
|
6168
|
+
*/
|
|
6169
|
+
withCondition(condition) {
|
|
6170
|
+
return (Component2) => (props) => {
|
|
6171
|
+
return condition(props) ? Component2(props) : null;
|
|
6172
|
+
};
|
|
6173
|
+
},
|
|
6174
|
+
/**
|
|
6175
|
+
* Loading state HOC
|
|
6176
|
+
*/
|
|
6177
|
+
withLoading(loadingComponent) {
|
|
6178
|
+
return (Component2) => (props) => {
|
|
6179
|
+
return props.loading ? loadingComponent(props) : Component2(props);
|
|
6180
|
+
};
|
|
6181
|
+
},
|
|
6182
|
+
/**
|
|
6183
|
+
* Error boundary HOC
|
|
6184
|
+
*/
|
|
6185
|
+
withError(errorComponent) {
|
|
6186
|
+
return (Component2) => (props) => {
|
|
6187
|
+
try {
|
|
6188
|
+
return Component2(props);
|
|
6189
|
+
} catch (error) {
|
|
6190
|
+
return errorComponent({ error, ...props });
|
|
6191
|
+
}
|
|
6192
|
+
};
|
|
6193
|
+
},
|
|
6194
|
+
/**
|
|
6195
|
+
* Memoization HOC
|
|
6196
|
+
*/
|
|
6197
|
+
withMemo(getMemoKey) {
|
|
6198
|
+
const cache = /* @__PURE__ */ new Map();
|
|
6199
|
+
return (Component2) => (props) => {
|
|
6200
|
+
const key = getMemoKey ? getMemoKey(props) : JSON.stringify(props);
|
|
6201
|
+
if (cache.has(key)) {
|
|
6202
|
+
return cache.get(key);
|
|
6203
|
+
}
|
|
6204
|
+
const result = Component2(props);
|
|
6205
|
+
cache.set(key, result);
|
|
6206
|
+
return result;
|
|
6207
|
+
};
|
|
6208
|
+
}
|
|
6209
|
+
};
|
|
6210
|
+
var compose = {
|
|
6211
|
+
/**
|
|
6212
|
+
* Combine multiple components into one
|
|
6213
|
+
*/
|
|
6214
|
+
combine(...components) {
|
|
6215
|
+
return (props) => ({
|
|
6216
|
+
fragment: {
|
|
6217
|
+
children: components.map((Component2) => Component2(props))
|
|
6218
|
+
}
|
|
6219
|
+
});
|
|
6220
|
+
},
|
|
6221
|
+
/**
|
|
6222
|
+
* Pipe components through transformations
|
|
6223
|
+
*/
|
|
6224
|
+
pipe(...transformers) {
|
|
6225
|
+
return (Component2) => {
|
|
6226
|
+
return transformers.reduce((acc, transformer) => transformer(acc), Component2);
|
|
6227
|
+
};
|
|
6228
|
+
},
|
|
6229
|
+
/**
|
|
6230
|
+
* Branch based on conditions
|
|
6231
|
+
*/
|
|
6232
|
+
branch(condition, leftComponent, rightComponent) {
|
|
6233
|
+
return (props) => {
|
|
6234
|
+
return condition(props) ? leftComponent(props) : rightComponent(props);
|
|
6235
|
+
};
|
|
6236
|
+
},
|
|
6237
|
+
/**
|
|
6238
|
+
* Render component or fallback
|
|
6239
|
+
*/
|
|
6240
|
+
maybe(Component2, fallback = null) {
|
|
6241
|
+
return (props) => {
|
|
6242
|
+
return Component2 ? Component2(props) : fallback;
|
|
6243
|
+
};
|
|
6244
|
+
}
|
|
6245
|
+
};
|
|
6246
|
+
|
|
6140
6247
|
// src/index.js
|
|
6141
6248
|
var scopeCounter = { value: 0 };
|
|
6142
6249
|
function generateScopeId() {
|
|
@@ -6191,10 +6298,46 @@ function dangerouslySetInnerContent(content) {
|
|
|
6191
6298
|
__trusted: true
|
|
6192
6299
|
};
|
|
6193
6300
|
}
|
|
6301
|
+
function injectHydrationAttributes(component, options) {
|
|
6302
|
+
if (!component || typeof component !== "object" || Array.isArray(component)) {
|
|
6303
|
+
return component;
|
|
6304
|
+
}
|
|
6305
|
+
const tagName = Object.keys(component)[0];
|
|
6306
|
+
if (!tagName) return component;
|
|
6307
|
+
const props = component[tagName];
|
|
6308
|
+
if (typeof props !== "object" || props === null) return component;
|
|
6309
|
+
const injected = { ...props };
|
|
6310
|
+
if (options.hydratable) {
|
|
6311
|
+
injected["data-hydratable"] = "true";
|
|
6312
|
+
}
|
|
6313
|
+
if (options.island) {
|
|
6314
|
+
injected["data-coherent-island"] = "true";
|
|
6315
|
+
}
|
|
6316
|
+
if (options._islandComponentName) {
|
|
6317
|
+
injected["data-coherent-island-component"] = options._islandComponentName;
|
|
6318
|
+
}
|
|
6319
|
+
return { [tagName]: injected };
|
|
6320
|
+
}
|
|
6321
|
+
function Island(componentFn) {
|
|
6322
|
+
const componentName = componentFn.name || "Anonymous";
|
|
6323
|
+
return function IslandComponent(props) {
|
|
6324
|
+
const result = componentFn(props);
|
|
6325
|
+
return injectHydrationAttributes(result, {
|
|
6326
|
+
island: true,
|
|
6327
|
+
_islandComponentName: componentName
|
|
6328
|
+
});
|
|
6329
|
+
};
|
|
6330
|
+
}
|
|
6194
6331
|
function render2(obj, options = {}) {
|
|
6195
6332
|
const scoped = options.scoped ?? options.encapsulate ?? false;
|
|
6196
|
-
const { scoped: _scoped, encapsulate: _encapsulate, ...rendererOptions } = options;
|
|
6197
|
-
|
|
6333
|
+
const { scoped: _scoped, encapsulate: _encapsulate, hydratable: _hydratable, island: _island, ...rendererOptions } = options;
|
|
6334
|
+
let component = scoped ? renderScopedComponent(obj) : obj;
|
|
6335
|
+
if (typeof component === "function") {
|
|
6336
|
+
component = component(options);
|
|
6337
|
+
}
|
|
6338
|
+
if (_hydratable || _island) {
|
|
6339
|
+
component = injectHydrationAttributes(component, { hydratable: _hydratable, island: _island });
|
|
6340
|
+
}
|
|
6198
6341
|
return render(component, rendererOptions);
|
|
6199
6342
|
}
|
|
6200
6343
|
function renderScopedComponent(component) {
|
|
@@ -6264,10 +6407,15 @@ function deepClone2(obj) {
|
|
|
6264
6407
|
}
|
|
6265
6408
|
return cloned;
|
|
6266
6409
|
}
|
|
6267
|
-
var
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
|
|
6410
|
+
var VERSION = "1.0.0-beta.8";
|
|
6411
|
+
var fp = {
|
|
6412
|
+
/**
|
|
6413
|
+
* Curried map: fp.map(fn)(array)
|
|
6414
|
+
*/
|
|
6415
|
+
map(fn) {
|
|
6416
|
+
return (array) => array.map(fn);
|
|
6417
|
+
}
|
|
6418
|
+
};
|
|
6271
6419
|
var coherent = {
|
|
6272
6420
|
// Core rendering
|
|
6273
6421
|
render: render2,
|
|
@@ -6337,9 +6485,11 @@ export {
|
|
|
6337
6485
|
FORBIDDEN_CHILDREN,
|
|
6338
6486
|
GlobalErrorHandler,
|
|
6339
6487
|
HTMLNestingError,
|
|
6488
|
+
Island,
|
|
6340
6489
|
LIFECYCLE_PHASES,
|
|
6341
6490
|
VERSION,
|
|
6342
6491
|
checkPeerDependencies,
|
|
6492
|
+
compose,
|
|
6343
6493
|
createActionHandlers,
|
|
6344
6494
|
createAsyncErrorBoundary,
|
|
6345
6495
|
createComponent,
|
|
@@ -6364,6 +6514,7 @@ export {
|
|
|
6364
6514
|
emitSync,
|
|
6365
6515
|
evaluateLazy,
|
|
6366
6516
|
events_default as eventSystem,
|
|
6517
|
+
fp,
|
|
6367
6518
|
getComponent,
|
|
6368
6519
|
getRegisteredComponents,
|
|
6369
6520
|
globalDOMIntegration,
|
|
@@ -6371,6 +6522,7 @@ export {
|
|
|
6371
6522
|
h,
|
|
6372
6523
|
handleAction,
|
|
6373
6524
|
hasChildren,
|
|
6525
|
+
hoc,
|
|
6374
6526
|
importPeerDependency,
|
|
6375
6527
|
initializeDOMIntegration,
|
|
6376
6528
|
isCoherentComponent,
|
|
@@ -6413,7 +6565,7 @@ export {
|
|
|
6413
6565
|
* Coherent.js - Object-Based Rendering Framework
|
|
6414
6566
|
* A pure JavaScript framework for server-side rendering using natural object syntax
|
|
6415
6567
|
*
|
|
6416
|
-
* @version 1.0.0-beta.
|
|
6568
|
+
* @version 1.0.0-beta.8
|
|
6417
6569
|
* @author Coherent Framework Team
|
|
6418
6570
|
* @license MIT
|
|
6419
6571
|
*/
|