Skip to content

Conversation

NtohnwiBih
Copy link

Description:
This pull request fixies an issue where mixins using the spread operator (...) were ignored when followed by other interpolated attributes in templates.
Problem:
The regex pattern (?:\s+...)?$ made the spread operator detection optional and required it to be at the end of the accumulated string. As a result, mixins were ignored in cases like:
<button ...${Red()} onclick="${count}"> <!-- Red() mixin was ignored -->
Solution:
The regex has been updated to \s+... (non-optional), ensuring the spread syntax is properly detected during parsing regardless of subsequent attributes.
Impact:

  • Mixins now behave consistently regardless of attribute order.
  • Maintains the declarative nature of the template system.

Related Issue: #19

Changed regex from (?:\\s+\\.\\.\\.)?$ to \\s+\\.\\.\\. so spread attributes
are recognized even when followed by other attributes. Prevents mixins from
being ignored and keeps template behavior consistent.
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

import { join } from 'path';
import typescript from '@rollup/plugin-typescript';
import { visualizer } from 'rollup-plugin-visualizer';
import { createRequire } from 'module';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this? Suspect we may not; would be great if we could keep using modern ES modules only, instead of the old require stuff.

import { isObservable, isPromise } from "../types/futures"
import { isRMLEventListener } from "../types/event-listener";
import { toListener } from "../utils/to-listener";
import { DatasetItemPreSink } from "../sinks/dataset-sink";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

/**
* Fix: Resolve mixin position dependency issue
*
* Problem: The regex pattern `(?:\s+\.\.\.)?$` made the spread operator detection optional and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(?:\s+\.\.\.)?

That spread "operator" is meant to be an optional piece of syntactic sugar and we'd rather keep it optional, as some people may not like it...

@dariomannu
Copy link
Contributor

Hi @NtohnwiBih how are you getting on? We're nearly there... can you just fix that little thing above, please, so we can merge this change? If something's not clear, please shout!

@NtohnwiBih
Copy link
Author

NtohnwiBih commented Oct 3, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants