@jqhtml/core 2.3.54 → 2.3.61
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/README.md +3 -1
- package/dist/component.d.ts +8 -5
- package/dist/component.d.ts.map +1 -1
- package/dist/index.cjs +56 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +56 -37
- package/dist/index.js.map +1 -1
- package/dist/instruction-processor.d.ts +2 -1
- package/dist/instruction-processor.d.ts.map +1 -1
- package/dist/jqhtml-core.esm.js +57 -38
- package/dist/jqhtml-core.esm.js.map +1 -1
- package/dist/load-coordinator.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,7 +15,9 @@ Components have a simple lifecycle: `on_load()` fetches data, `on_render()` sets
|
|
|
15
15
|
|
|
16
16
|
## Status
|
|
17
17
|
|
|
18
|
-
Alpha release. It works and I use it daily, but expect rough edges.
|
|
18
|
+
Alpha release. It works and I use it daily, but expect rough edges.
|
|
19
|
+
|
|
20
|
+
Full documentation: **[docs.jqhtml.org](https://docs.jqhtml.org/)**
|
|
19
21
|
|
|
20
22
|
If you try it in a project, I'd love to hear about it.
|
|
21
23
|
|
package/dist/component.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ declare global {
|
|
|
18
18
|
export declare class Jqhtml_Component {
|
|
19
19
|
static __jqhtml_component: boolean;
|
|
20
20
|
static template?: any;
|
|
21
|
+
static readonly COMPONENT_NAME_PATTERN: RegExp;
|
|
21
22
|
$: any;
|
|
22
23
|
args: Record<string, any>;
|
|
23
24
|
data: Record<string, any>;
|
|
@@ -482,6 +483,13 @@ export declare class Jqhtml_Component {
|
|
|
482
483
|
find(selector: string): Jqhtml_Component[];
|
|
483
484
|
/**
|
|
484
485
|
* Find closest ancestor component matching selector
|
|
486
|
+
*
|
|
487
|
+
* A bare component name - a plain identifier starting with a capital letter,
|
|
488
|
+
* such as 'Parent_Dashboard' - is treated as the component-name class
|
|
489
|
+
* selector '.Parent_Dashboard'. Components carry a CSS class for every name
|
|
490
|
+
* in their prototype chain, so a base class name matches its subclasses too.
|
|
491
|
+
* Every other selector ('.Foo', '#id', '[attr]', 'div > .Component') is
|
|
492
|
+
* passed to jQuery unchanged.
|
|
485
493
|
*/
|
|
486
494
|
closest(selector: string): Jqhtml_Component | null;
|
|
487
495
|
/**
|
|
@@ -489,11 +497,6 @@ export declare class Jqhtml_Component {
|
|
|
489
497
|
*/
|
|
490
498
|
static get_class_hierarchy(): string[];
|
|
491
499
|
private _generate_cid;
|
|
492
|
-
/**
|
|
493
|
-
* Flatten instruction array - converts ['_content', [...]] markers to flat array
|
|
494
|
-
* Recursively flattens nested content from content() calls
|
|
495
|
-
*/
|
|
496
|
-
private _flatten_instructions;
|
|
497
500
|
private _apply_css_classes;
|
|
498
501
|
private _apply_default_attributes;
|
|
499
502
|
private _set_attributes;
|
package/dist/component.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../src/component.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAuBH,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,YAAY,CAAC,EAAE;YACb,GAAG,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;YACjF,UAAU,EAAE,MAAM,IAAI,CAAC;SACxB,CAAC;KACH;CACF;AAED,qBAAa,gBAAgB;IAE3B,MAAM,CAAC,kBAAkB,UAAQ;IACjC,MAAM,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC;IAGtB,CAAC,EAAE,GAAG,CAAC;IACP,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC,M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,GAAG,IAAI;IAIzF;;;;OAIG;IACH,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,SAAS,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI;IAI3F;;;OAGG;IACH,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI;IAI7C;;OAEG;IACH,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAI3C;;;OAGG;IACH,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAIpC;;;;;;;;;;;;;;;OAeG;IACH,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG;IAgB3B;;;;;;;;;;;;;;;OAeG;IACH,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI;IAgB9C;;;OAGG;IACH,YAAY,IAAI,gBAAgB,GAAG,IAAI;IAIvC;;OAEG;IACH,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,EAAE;IAa1C;;;;;;;;;OASG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI;IAwBlD;;OAEG;IACH,MAAM,CAAC,mBAAmB,IAAI,MAAM,EAAE;IA0CtC,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,kBAAkB;IA4B1B,OAAO,CAAC,yBAAyB;IAuHjC,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,mBAAmB;IAO3B,OAAO,CAAC,gBAAgB;IAcxB;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IA+BzB,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,UAAU;CAUnB"}
|
package/dist/index.cjs
CHANGED
|
@@ -638,7 +638,9 @@ function process_instructions(instructions, target, context, slots) {
|
|
|
638
638
|
if (el) {
|
|
639
639
|
const element = $(el);
|
|
640
640
|
el.removeAttribute('data-tid');
|
|
641
|
-
|
|
641
|
+
// Bind to the component whose template wrote this element, which for
|
|
642
|
+
// spliced content is not the component being rendered.
|
|
643
|
+
apply_attributes(element, tagData.attrs, tagData.context);
|
|
642
644
|
}
|
|
643
645
|
}
|
|
644
646
|
// Third pass: initialize and boot components in parallel
|
|
@@ -664,6 +666,16 @@ function process_instruction_to_html(instruction, html, tagElements, components,
|
|
|
664
666
|
// Raw HTML/text - no escaping, as requested
|
|
665
667
|
html.push(instruction);
|
|
666
668
|
}
|
|
669
|
+
else if (Array.isArray(instruction)) {
|
|
670
|
+
if (instruction[0] !== '_content' || !Array.isArray(instruction[1])) {
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
// Content written in another template renders in that template's component.
|
|
674
|
+
const definer = instruction[2] || context;
|
|
675
|
+
for (const item of instruction[1]) {
|
|
676
|
+
process_instruction_to_html(item, html, tagElements, components, definer, slots);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
667
679
|
else if ('tag' in instruction) {
|
|
668
680
|
// HTML tag
|
|
669
681
|
process_tag_to_html(instruction, html, tagElements, components, context);
|
|
@@ -860,11 +872,22 @@ function process_rawtag_to_html(instruction, html) {
|
|
|
860
872
|
}
|
|
861
873
|
}
|
|
862
874
|
html.push('>');
|
|
863
|
-
// Add raw content
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
875
|
+
// Add raw content, preserving whitespace.
|
|
876
|
+
//
|
|
877
|
+
// <textarea> holds text and nothing else, so everything is escaped.
|
|
878
|
+
//
|
|
879
|
+
// <pre> holds phrasing content - <pre><code> is the standard code-block idiom - so
|
|
880
|
+
// markup the author wrote is passed through. A '<' that does not begin a tag is
|
|
881
|
+
// still escaped, which is what the HTML tokenizer itself does with a stray '<' and
|
|
882
|
+
// keeps code samples such as "if (a < b)" rendering as written. Interpolated
|
|
883
|
+
// values are escaped by the compiler before they reach this point.
|
|
884
|
+
const is_raw_html_content = tagName.toLowerCase() === 'pre';
|
|
885
|
+
const escaped_content = is_raw_html_content
|
|
886
|
+
? rawContent.replace(/<(?![a-zA-Z/!?])/g, '<')
|
|
887
|
+
: rawContent
|
|
888
|
+
.replace(/&/g, '&')
|
|
889
|
+
.replace(/</g, '<')
|
|
890
|
+
.replace(/>/g, '>');
|
|
868
891
|
html.push(escaped_content);
|
|
869
892
|
// Close tag
|
|
870
893
|
html.push(`</${tagName}>`);
|
|
@@ -1536,6 +1559,11 @@ class Load_Coordinator {
|
|
|
1536
1559
|
}
|
|
1537
1560
|
if (!uncacheable_property) {
|
|
1538
1561
|
uncacheable_property = key;
|
|
1562
|
+
// This package compiles with strictNullChecks off, and without it
|
|
1563
|
+
// TypeScript will not narrow a discriminated union by its boolean
|
|
1564
|
+
// discriminant - so `serialized` is still the full Serialize_Result
|
|
1565
|
+
// here even though `ok` has been ruled out above. The cast states
|
|
1566
|
+
// what the control flow already guarantees.
|
|
1539
1567
|
uncacheable_reason = serialized.reason;
|
|
1540
1568
|
}
|
|
1541
1569
|
return { key: null, uncacheable_property, uncacheable_reason };
|
|
@@ -1823,7 +1851,7 @@ Load_Coordinator._registry = new Map();
|
|
|
1823
1851
|
const class_registry = Object.create(null);
|
|
1824
1852
|
// Markers for serialized class instances (unique to avoid collisions with user data)
|
|
1825
1853
|
// Replaced at build time by rollup (see rollup.config.js).
|
|
1826
|
-
const CORE_VERSION = '2.3.
|
|
1854
|
+
const CORE_VERSION = '2.3.61';
|
|
1827
1855
|
const CLASS_MARKER = '__jqhtml_class__';
|
|
1828
1856
|
const PROPS_MARKER = '__jqhtml_props__';
|
|
1829
1857
|
/**
|
|
@@ -3832,10 +3860,10 @@ class Jqhtml_Component {
|
|
|
3832
3860
|
// Create a content function that invokes child slots
|
|
3833
3861
|
// When parent calls content('slotName'), it invokes the child's slot function
|
|
3834
3862
|
const childSlots = instructions._slots;
|
|
3835
|
-
const contentFunction = (slotName,
|
|
3863
|
+
const contentFunction = (slotName, ...slotArgs) => {
|
|
3836
3864
|
if (childSlots[slotName] && typeof childSlots[slotName] === 'function') {
|
|
3837
|
-
// Invoke the slot function with
|
|
3838
|
-
const [slotInstructions, slotContext] = childSlots[slotName](
|
|
3865
|
+
// Invoke the slot function with everything content() was given
|
|
3866
|
+
const [slotInstructions, slotContext] = childSlots[slotName](...slotArgs);
|
|
3839
3867
|
// Return in render function format: [instructions, context]
|
|
3840
3868
|
// The template expression handler expects this format
|
|
3841
3869
|
return [slotInstructions, slotContext];
|
|
@@ -3860,12 +3888,11 @@ class Jqhtml_Component {
|
|
|
3860
3888
|
instructions = [];
|
|
3861
3889
|
}
|
|
3862
3890
|
}
|
|
3863
|
-
//
|
|
3864
|
-
//
|
|
3865
|
-
|
|
3866
|
-
// Process instructions to generate DOM
|
|
3891
|
+
// Process instructions to generate DOM. ['_content', ...] markers from
|
|
3892
|
+
// content() are handled by the processor, which renders them in the
|
|
3893
|
+
// component that wrote them.
|
|
3867
3894
|
// This kicks off child component boots but doesn't wait for them
|
|
3868
|
-
process_instructions(
|
|
3895
|
+
process_instructions(instructions, this.$, this);
|
|
3869
3896
|
}
|
|
3870
3897
|
// Don't update ready state here - let phases complete in order
|
|
3871
3898
|
this._update_debug_attrs();
|
|
@@ -4957,11 +4984,21 @@ class Jqhtml_Component {
|
|
|
4957
4984
|
}
|
|
4958
4985
|
/**
|
|
4959
4986
|
* Find closest ancestor component matching selector
|
|
4987
|
+
*
|
|
4988
|
+
* A bare component name - a plain identifier starting with a capital letter,
|
|
4989
|
+
* such as 'Parent_Dashboard' - is treated as the component-name class
|
|
4990
|
+
* selector '.Parent_Dashboard'. Components carry a CSS class for every name
|
|
4991
|
+
* in their prototype chain, so a base class name matches its subclasses too.
|
|
4992
|
+
* Every other selector ('.Foo', '#id', '[attr]', 'div > .Component') is
|
|
4993
|
+
* passed to jQuery unchanged.
|
|
4960
4994
|
*/
|
|
4961
4995
|
closest(selector) {
|
|
4996
|
+
const search = Jqhtml_Component.COMPONENT_NAME_PATTERN.test(selector)
|
|
4997
|
+
? `.${selector}`
|
|
4998
|
+
: selector;
|
|
4962
4999
|
let current = this.$.parent();
|
|
4963
5000
|
while (current.length > 0) {
|
|
4964
|
-
if (current.is(
|
|
5001
|
+
if (current.is(search)) {
|
|
4965
5002
|
const comp = current.data('_component');
|
|
4966
5003
|
if (comp instanceof Jqhtml_Component) {
|
|
4967
5004
|
return comp;
|
|
@@ -5015,26 +5052,6 @@ class Jqhtml_Component {
|
|
|
5015
5052
|
_generate_cid() {
|
|
5016
5053
|
return uid();
|
|
5017
5054
|
}
|
|
5018
|
-
/**
|
|
5019
|
-
* Flatten instruction array - converts ['_content', [...]] markers to flat array
|
|
5020
|
-
* Recursively flattens nested content from content() calls
|
|
5021
|
-
*/
|
|
5022
|
-
_flatten_instructions(instructions) {
|
|
5023
|
-
const result = [];
|
|
5024
|
-
for (const instruction of instructions) {
|
|
5025
|
-
// Check if this is a _content marker: ['_content', [...]]
|
|
5026
|
-
if (Array.isArray(instruction) && instruction[0] === '_content' && Array.isArray(instruction[1])) {
|
|
5027
|
-
// Recursively flatten the content instructions
|
|
5028
|
-
const contentInstructions = this._flatten_instructions(instruction[1]);
|
|
5029
|
-
result.push(...contentInstructions);
|
|
5030
|
-
}
|
|
5031
|
-
else {
|
|
5032
|
-
// Regular instruction - keep as is
|
|
5033
|
-
result.push(instruction);
|
|
5034
|
-
}
|
|
5035
|
-
}
|
|
5036
|
-
return result;
|
|
5037
|
-
}
|
|
5038
5055
|
_apply_css_classes() {
|
|
5039
5056
|
const hierarchy = this.constructor.get_class_hierarchy();
|
|
5040
5057
|
// If component name differs from class name, add component name to hierarchy
|
|
@@ -5258,6 +5275,8 @@ class Jqhtml_Component {
|
|
|
5258
5275
|
}
|
|
5259
5276
|
// Static properties
|
|
5260
5277
|
Jqhtml_Component.__jqhtml_component = true; // Marker for unified register() detection
|
|
5278
|
+
// A bare component name, as accepted by closest() in place of a class selector
|
|
5279
|
+
Jqhtml_Component.COMPONENT_NAME_PATTERN = /^[A-Z][A-Za-z0-9_]*$/;
|
|
5261
5280
|
|
|
5262
5281
|
/**
|
|
5263
5282
|
* JQHTML v2 Template Renderer
|
|
@@ -6154,7 +6173,7 @@ function init(jQuery, config) {
|
|
|
6154
6173
|
}
|
|
6155
6174
|
}
|
|
6156
6175
|
// Version - will be replaced during build with actual version from package.json
|
|
6157
|
-
const version = '2.3.
|
|
6176
|
+
const version = '2.3.61';
|
|
6158
6177
|
// Default export with all functionality
|
|
6159
6178
|
const jqhtml = {
|
|
6160
6179
|
// Core
|