@jqhtml/core 2.3.6 → 2.3.9

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.
@@ -61,4 +61,14 @@ export declare function list_components(): Record<string, {
61
61
  has_class: boolean;
62
62
  has_template: boolean;
63
63
  }>;
64
+ /**
65
+ * Unified registration function - auto-detects source type and delegates
66
+ *
67
+ * Accepts either:
68
+ * - A compiled JQHTML template (has __jqhtml_template: true)
69
+ * - A component class extending Jqhtml_Component (has static __jqhtml_component: true and static component_name)
70
+ *
71
+ * @param source - Compiled template or component class
72
+ */
73
+ export declare function register(source: TemplateDefinition | ComponentConstructor): void;
64
74
  //# sourceMappingURL=component-registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"component-registry.d.ts","sourceRoot":"","sources":["../src/component-registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGlD,MAAM,MAAM,gBAAgB,GAAG,CAC7B,IAAI,EAAE,gBAAgB,EACtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,OAAO,EAAE,GAAG,KACT,CAAC,GAAG,EAAE,EAAE,gBAAgB,CAAC,CAAC;AAG/B,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,gBAAgB,CAAC;CAC1B;AAGD,MAAM,MAAM,oBAAoB,GAAG,KAAK,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,EAAE,GAAG,KAAK,gBAAgB,CAAC;AAsCtG;;GAEG;AACH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G,CAAM,GAC7B,gBAAgB,CAGlB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,EAAE,CAE9C;AAED;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,EAAE,CAEnD;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAAC,MAAM,EAAE;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE,OAAO,CAAA;CAAE,CAAC,CAsB/F;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,kBAAkB,GAAG,oBAAoB,GAAG,IAAI,CA0ChF"}
@@ -16,6 +16,7 @@ declare global {
16
16
  }
17
17
  }
18
18
  export declare class Jqhtml_Component {
19
+ static __jqhtml_component: boolean;
19
20
  static template?: any;
20
21
  $: any;
21
22
  args: Record<string, any>;
@@ -1 +1 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../src/component.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAcH,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,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,MAAM,EAAE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"}
package/dist/index.cjs CHANGED
@@ -355,6 +355,50 @@ function list_components() {
355
355
  }
356
356
  return result;
357
357
  }
358
+ /**
359
+ * Unified registration function - auto-detects source type and delegates
360
+ *
361
+ * Accepts either:
362
+ * - A compiled JQHTML template (has __jqhtml_template: true)
363
+ * - A component class extending Jqhtml_Component (has static __jqhtml_component: true and static component_name)
364
+ *
365
+ * @param source - Compiled template or component class
366
+ */
367
+ function register(source) {
368
+ // Check for template (compiled .jqhtml file)
369
+ if (source && typeof source === 'object' && '__jqhtml_template' in source && source.__jqhtml_template === true) {
370
+ register_template(source);
371
+ return;
372
+ }
373
+ // Check for component class (extends Jqhtml_Component)
374
+ if (source && typeof source === 'function' && '__jqhtml_component' in source && source.__jqhtml_component === true) {
375
+ const component_name = source.component_name;
376
+ if (!component_name || typeof component_name !== 'string') {
377
+ throw new Error('[JQHTML] Component class must define static component_name property.\n\n' +
378
+ 'Example:\n' +
379
+ ' class My_Component extends Jqhtml_Component {\n' +
380
+ ' static component_name = "My_Component";\n' +
381
+ ' // ...\n' +
382
+ ' }\n\n' +
383
+ 'Alternatively, use register_component(name, class) to specify the name explicitly:\n' +
384
+ ' jqhtml.register_component("My_Component", My_Component);');
385
+ }
386
+ register_component(component_name, source);
387
+ return;
388
+ }
389
+ // Unknown type - provide helpful error
390
+ throw new Error('[JQHTML] register() requires a compiled JQHTML template or a component class.\n\n' +
391
+ 'For templates:\n' +
392
+ ' import My_Template from "./my_component.jqhtml";\n' +
393
+ ' jqhtml.register(My_Template);\n\n' +
394
+ 'For classes (with static component_name):\n' +
395
+ ' class My_Component extends Jqhtml_Component {\n' +
396
+ ' static component_name = "My_Component";\n' +
397
+ ' }\n' +
398
+ ' jqhtml.register(My_Component);\n\n' +
399
+ 'For classes (without static component_name):\n' +
400
+ ' jqhtml.register_component("My_Component", My_Component);');
401
+ }
358
402
 
359
403
  /**
360
404
  * JQHTML v2 Instruction Processor
@@ -2761,6 +2805,8 @@ class Jqhtml_Component {
2761
2805
  };
2762
2806
  }
2763
2807
  }
2808
+ // Static properties
2809
+ Jqhtml_Component.__jqhtml_component = true; // Marker for unified register() detection
2764
2810
 
2765
2811
  /**
2766
2812
  * JQHTML v2 Template Renderer
@@ -3352,47 +3398,6 @@ function init_jquery_plugin(jQuery) {
3352
3398
  // Return the jQuery element to enable chaining (fluent interface pattern)
3353
3399
  return targetElement;
3354
3400
  };
3355
- // Store original jQuery methods for overriding
3356
- const _jqhtml_jquery_overrides = {};
3357
- // EXPERIMENTAL: Override DOM manipulation methods to support component instances as arguments
3358
- // and to trigger ready() when components are added to the DOM
3359
- // NOTE: This feature needs thorough testing in production scenarios
3360
- const dom_insertion_methods = ['append', 'prepend', 'before', 'after', 'replaceWith'];
3361
- for (const fnname of dom_insertion_methods) {
3362
- _jqhtml_jquery_overrides[fnname] = jQuery.fn[fnname];
3363
- jQuery.fn[fnname] = function (...args) {
3364
- // Resolve all component instances into jQuery elements
3365
- const resolvedArgs = args.map(arg => {
3366
- if (arg && typeof arg === 'object' && arg instanceof Jqhtml_Component) {
3367
- return arg.$;
3368
- }
3369
- return arg;
3370
- });
3371
- // Make a list of all jQuery elements in the arguments
3372
- const $elements = resolvedArgs.filter((arg) => arg instanceof jQuery);
3373
- // Call the original jQuery method with resolved arguments
3374
- const ret = _jqhtml_jquery_overrides[fnname].apply(this, resolvedArgs);
3375
- // For each jQuery element that is now in the DOM and hasn't triggered ready yet,
3376
- // find any uninitialized components and boot them
3377
- for (const $e of $elements) {
3378
- // Check if element is in the DOM
3379
- if ($e.closest('html').length > 0) {
3380
- // Find any components that haven't been initialized yet
3381
- $e.find('.Component').addBack('.Component').each(function () {
3382
- const $comp = jQuery(this);
3383
- const component = $comp.data('_component');
3384
- // If component exists and hasn't been booted yet, boot it
3385
- if (component && !component._ready_state) {
3386
- component._boot();
3387
- }
3388
- });
3389
- }
3390
- }
3391
- return ret;
3392
- };
3393
- }
3394
- // Note: Component destruction is handled automatically by MutationObserver
3395
- // in lifecycle-manager.ts. No jQuery method overrides needed for cleanup.
3396
3401
  /**
3397
3402
  * shallowFind - Find nearest descendants matching selector
3398
3403
  *
@@ -4054,16 +4059,17 @@ function init(jQuery) {
4054
4059
  }
4055
4060
  }
4056
4061
  // Version - will be replaced during build with actual version from package.json
4057
- const version = '2.3.6';
4062
+ const version = '2.3.9';
4058
4063
  // Default export with all functionality
4059
4064
  const jqhtml = {
4060
4065
  // Core
4061
4066
  Jqhtml_Component,
4062
4067
  LifecycleManager,
4063
4068
  // Registry
4069
+ register,
4064
4070
  register_component,
4065
- get_component_class,
4066
4071
  register_template,
4072
+ get_component_class,
4067
4073
  get_template,
4068
4074
  get_template_by_class,
4069
4075
  create_component,
@@ -4187,6 +4193,7 @@ exports.logDispatch = logDispatch;
4187
4193
  exports.logInstruction = logInstruction;
4188
4194
  exports.logLifecycle = logLifecycle;
4189
4195
  exports.process_instructions = process_instructions;
4196
+ exports.register = register;
4190
4197
  exports.register_component = register_component;
4191
4198
  exports.register_template = register_template;
4192
4199
  exports.render_template = render_template;