@jqhtml/core 2.3.75 → 2.3.76
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/component.d.ts.map +1 -1
- package/dist/index.cjs +34 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +34 -5
- package/dist/index.js.map +1 -1
- package/dist/jqhtml-core.esm.js +35 -6
- package/dist/jqhtml-core.esm.js.map +1 -1
- package/dist/markup.d.ts +12 -0
- package/dist/markup.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/jqhtml-core.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* JQHTML Core v2.3.
|
|
2
|
+
* JQHTML Core v2.3.76
|
|
3
3
|
* (c) 2025 JQHTML Team
|
|
4
4
|
* Released under the MIT License
|
|
5
5
|
*/
|
|
@@ -501,6 +501,32 @@ class Jqhtml_Markup {
|
|
|
501
501
|
this.p = this.instructions.push.bind(this.instructions);
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
|
+
/**
|
|
505
|
+
* Whether a buffer emits anything: an element, a component, or text that is not
|
|
506
|
+
* only HTML whitespace (space, tab, LF, FF, CR - a non-breaking space is content).
|
|
507
|
+
* A spliced buffer counts by what it emits itself, so a slot that only forwards
|
|
508
|
+
* an empty slot is empty too. A component counts even if it later renders
|
|
509
|
+
* nothing; that is not knowable without booting it.
|
|
510
|
+
*
|
|
511
|
+
* content() returns '' for a buffer without content: a caller cannot omit a
|
|
512
|
+
* <Slot:> tag conditionally, so writing it empty is how a caller says "nothing
|
|
513
|
+
* here", and it must test falsy like an absent slot.
|
|
514
|
+
*/
|
|
515
|
+
function markup_has_content(markup) {
|
|
516
|
+
for (const instruction of markup.instructions) {
|
|
517
|
+
if (instruction instanceof Jqhtml_Markup) {
|
|
518
|
+
if (markup_has_content(instruction))
|
|
519
|
+
return true;
|
|
520
|
+
}
|
|
521
|
+
else if (instruction !== null && typeof instruction === 'object') {
|
|
522
|
+
return true;
|
|
523
|
+
}
|
|
524
|
+
else if (/[^ \t\n\f\r]/.test(String(instruction))) {
|
|
525
|
+
return true;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
return false;
|
|
529
|
+
}
|
|
504
530
|
|
|
505
531
|
/**
|
|
506
532
|
* JQHTML v2 Component Registry
|
|
@@ -1913,7 +1939,7 @@ function serialize_for_cache_key(value) {
|
|
|
1913
1939
|
const class_registry = Object.create(null);
|
|
1914
1940
|
// Markers for serialized class instances (unique to avoid collisions with user data)
|
|
1915
1941
|
// Replaced at build time by rollup (see rollup.config.js).
|
|
1916
|
-
const CORE_VERSION = '2.3.
|
|
1942
|
+
const CORE_VERSION = '2.3.76';
|
|
1917
1943
|
const CLASS_MARKER = '__jqhtml_class__';
|
|
1918
1944
|
const PROPS_MARKER = '__jqhtml_props__';
|
|
1919
1945
|
// How a serialized text is checked for anything the deserialize walk has to act
|
|
@@ -5399,6 +5425,9 @@ class Jqhtml_Component {
|
|
|
5399
5425
|
// console.log('[Component] this.constructor.name:', this.constructor.name);
|
|
5400
5426
|
// console.log('[Component] this.data:', this.data);
|
|
5401
5427
|
// console.log('[Component] this.args:', this.args);
|
|
5428
|
+
// What content() returns: the slot's buffer, or '' when it emits nothing (see
|
|
5429
|
+
// markup_has_content), so a slot written empty tests falsy like an absent one
|
|
5430
|
+
const content_or_empty = (markup) => markup instanceof Jqhtml_Markup && !markup_has_content(markup) ? '' : markup;
|
|
5402
5431
|
// Create content function that handles both default content and named slots
|
|
5403
5432
|
const createContentFunction = () => {
|
|
5404
5433
|
const defaultContentFn = this.args._innerhtml_function;
|
|
@@ -5408,7 +5437,7 @@ class Jqhtml_Component {
|
|
|
5408
5437
|
// If slot name provided and slots object exists, try to use named slot
|
|
5409
5438
|
if (slotName && slotsObj && slotsObj[slotName]) {
|
|
5410
5439
|
// Call the slot function - it returns its markup buffer
|
|
5411
|
-
return slotsObj[slotName](...slotArgs);
|
|
5440
|
+
return content_or_empty(slotsObj[slotName](...slotArgs));
|
|
5412
5441
|
}
|
|
5413
5442
|
// If slot name provided but not found, return empty
|
|
5414
5443
|
else if (slotName) {
|
|
@@ -5416,7 +5445,7 @@ class Jqhtml_Component {
|
|
|
5416
5445
|
}
|
|
5417
5446
|
// No slot name = default content
|
|
5418
5447
|
else if (defaultContentFn) {
|
|
5419
|
-
return defaultContentFn(this);
|
|
5448
|
+
return content_or_empty(defaultContentFn(this));
|
|
5420
5449
|
}
|
|
5421
5450
|
// No content at all
|
|
5422
5451
|
else {
|
|
@@ -5449,7 +5478,7 @@ class Jqhtml_Component {
|
|
|
5449
5478
|
if (childSlots[slotName] && typeof childSlots[slotName] === 'function') {
|
|
5450
5479
|
// Invoke the slot function with everything content() was given; its
|
|
5451
5480
|
// markup buffer is what the template expression handler splices
|
|
5452
|
-
return childSlots[slotName](...slotArgs);
|
|
5481
|
+
return content_or_empty(childSlots[slotName](...slotArgs));
|
|
5453
5482
|
}
|
|
5454
5483
|
// Slot not found, return empty
|
|
5455
5484
|
return '';
|
|
@@ -8929,7 +8958,7 @@ function init(jQuery, config) {
|
|
|
8929
8958
|
}
|
|
8930
8959
|
}
|
|
8931
8960
|
// Version - will be replaced during build with actual version from package.json
|
|
8932
|
-
const version = '2.3.
|
|
8961
|
+
const version = '2.3.76';
|
|
8933
8962
|
// Default export with all functionality
|
|
8934
8963
|
const jqhtml = {
|
|
8935
8964
|
// Core
|