Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve namespace readability and potential optimization conflict #2928

Merged
merged 6 commits into from
Dec 3, 2023

Conversation

idoros
Copy link
Collaborator

@idoros idoros commented Nov 26, 2023

This PR introduces a few improvements to the way stylesheet meta namespaces are resolved:

  1. To mitigate potential conflicts involving the underscore character (_), which may clash with the target local delimiter, this update reduce multiple consecutive underscores into a single underscore.

  2. Extends support for the hyphen character (-). It similarly trims consecutive hyphens to a single instance, thereby preventing issues related to state transformation conflicts. This change is particularly beneficial for handling default namespaces derived from file paths with dashes. By preserving these dashes, the resulting namespaces become more readable and accurately reflect their source file paths.

  3. Extends support for non ASCII characters in the namespace value.

  4. Align @st-namespace validation with the allowed transformed value that is generated from a stylesheet filename.

-  filename2varname
- string2varname
- trim consequence underscores into a single "_"
- trim consequence dashes into a single "-" to prevent local delimiter ambiguity
- fix tests that assumed previous behavior
@idoros idoros added feature New syntax feature or behavior core Processing and transforming logic labels Nov 26, 2023
@idoros idoros requested a review from barak007 November 26, 2023 13:15
@idoros idoros self-assigned this Nov 26, 2023
- st-namespace value is not transformed, but is validated to be a valid identifier start and also not to conflict with stylable local/state namespacing
@idoros idoros merged commit 09fb4b3 into master Dec 3, 2023
12 checks passed
@idoros idoros deleted the ido/improve-namespace branch December 3, 2023 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Processing and transforming logic feature New syntax feature or behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants