@tsrx/core 0.1.8 → 0.1.10

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.
@@ -162,14 +162,14 @@ function visit_source_ast(ast, src_line_offsets, { regions, css_element_info })
162
162
  start: cssStart,
163
163
  end: cssEnd,
164
164
  content: node.css,
165
- id: get_style_region_id(node.metadata.styleScopeHash, `head-${region_id}`),
165
+ id: get_style_region_id(node.metadata.styleScopeHash, `head-${region_id++}`),
166
166
  });
167
167
  }
168
168
 
169
169
  context.next();
170
170
  },
171
171
  Attribute(node, context) {
172
- const element = context.path?.find((n) => n.type === 'Element');
172
+ const element = context.path?.findLast((n) => n.type === 'Element');
173
173
  if (element?.metadata?.css?.scopedClasses) {
174
174
  // we don't need to check is_element_dom_element(node)
175
175
  // since scopedClasses are added during pruning only to DOM elements
@@ -568,10 +568,11 @@ export function convert_source_map_to_mappings(
568
568
  if (node.loc && node.name) {
569
569
  /** @type {Token} */
570
570
  const token = {
571
- source: node.metadata?.is_capitalized ? node.metadata.source_name : node.name,
571
+ source: node.metadata?.source_name ?? node.name,
572
572
  generated: node.name,
573
573
  loc: node.loc,
574
574
  metadata: {},
575
+ sourceLength: node.metadata?.source_length,
575
576
  };
576
577
  if (node.metadata?.disable_verification) {
577
578
  token.mappingData = { ...mapping_data, verification: false };
@@ -708,16 +709,24 @@ export function convert_source_map_to_mappings(
708
709
  visit(node.value);
709
710
  }
710
711
  } else {
712
+ const is_class_attribute =
713
+ node.name?.type === 'JSXIdentifier' &&
714
+ (node.name.name === 'class' || node.name.name === 'className');
711
715
  const attr =
712
- node.name.name === 'class' && node.value?.type === 'JSXExpressionContainer'
716
+ is_class_attribute && node.value?.type === 'JSXExpressionContainer'
713
717
  ? node.value.expression
714
718
  : node.value;
715
719
 
716
- const css = attr
717
- ? css_element_info.get(`${attr.loc?.start.line}:${attr.loc?.start.column}`)
718
- : null;
720
+ const css =
721
+ is_class_attribute && attr
722
+ ? css_element_info.get(`${attr.loc?.start.line}:${attr.loc?.start.column}`)
723
+ : null;
719
724
 
720
725
  if (attr && css) {
726
+ if (node.name) {
727
+ visit(node.name);
728
+ }
729
+
721
730
  // Extract class names from the attribute value
722
731
  const classes = extract_classes(
723
732
  attr,
@@ -861,7 +870,7 @@ export function convert_source_map_to_mappings(
861
870
  target_node,
862
871
  src_to_gen_map,
863
872
  gen_line_offsets,
864
- mapping_data_verify_only,
873
+ closing ? mapping_data_verify_only : mapping_data_verify_complete,
865
874
  );
866
875
  // The generated code includes a semicolon after the closing or self-closed tag
867
876
  // We're extending the mapping to include the semicolon
@@ -345,6 +345,8 @@ export interface JsxPlatform {
345
345
  * explicit `ref={normalized.ref}` attribute.
346
346
  */
347
347
  hostSpreadRefStrategy?: 'explicit-ref-attr';
348
+ /** Native host prop used when lowering a sole child `{html ...}`. */
349
+ htmlProp?: 'dangerouslySetInnerHTML' | 'innerHTML';
348
350
  };
349
351
 
350
352
  validation: {