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

[🚀esl-media-query]: (POC) consider out of the box support for esl-media-query-list syntax recognition #2377

Closed
ala-n opened this issue Apr 30, 2024 · 1 comment · Fixed by #2452

Comments

@ala-n
Copy link
Collaborator

ala-n commented Apr 30, 2024

Request

As for now we have two syntaxes to declare ESLMediaRuleList:

  • Tupple : ESLMediaRuleList.parse('value1|value2', '@mq1|@mq2');
  • Arrow: ESLMediaRuleList.parse('@mq1 => value1| @mq2 =>value2');

It is requested to have out of the box method to support both notations in case media tuple used as a default method.
So
ESLMediaRuleList.parse('@mqAlt1 => value1| @mqAlt2 =>value2', '@mq1|@mq2'); or
ESLMediaRuleList.parseAuto('@mqAlt1 => value1| @mqAlt2 =>value2', '@mq1|@mq2'); parse first argument as an arrow syntax without default tuple consideration.

--- Usage Example ----

/** Parses adaptive value to optimized {@link ESLMediaRuleList} */
export const parseAdaptiveValue = (value: string, mask: string): ESLMediaRuleList => {
 if (value.includes('=>')) return ESLMediaRuleList.parse(value);
 const length = value.split('|').length;
 mask= mask.split('|').slice(0, length).join('|');
 return ESLMediaRuleList.parse(mask, value);
};

ACCETANCE CRITERIA

(Updated 16.07.2024)

  • Current ESLMediaRuleList.parse is deprecated and available for reimplementation in 5th version
    So current parse implementation is not requested to be saved

  • The result signature is expected to be the following:

   /** Alias for parseQuery */
   parse(query: string): ESLMediaRuleList;
   /** Alias for parseQuery */
   parse(query: string, parser: RulePayloadParser): ESLMediaRuleList;
   
    /** Parses query considering it tuple or query syntax based on the actual value */
   parse(query: string, mask: string): ESLMediaRuleList;
    /** Parses query considering it tuple or query syntax based on the actual value with passed parser for values */
   parse(query: string, mask: string, parser: RulePayloadParser): ESLMediaRuleList;
  • USE DEFINITION OF THE ORIGINAL REQUEST AS A VALID AC
@ala-n ala-n added waits triage Issue that waits to be reviewed and handled under discussion labels Apr 30, 2024
@ala-n ala-n added this to the ⚡ESL: 5.1.0 Minor release milestone Apr 30, 2024
@ala-n ala-n changed the title [🚀esl-maedia-query]: consider out of the box support for esl-media-query-list syntax recognition [🚀esl-media-query]: consider out of the box support for esl-media-query-list syntax recognition May 3, 2024
@ala-n ala-n changed the title [🚀esl-media-query]: consider out of the box support for esl-media-query-list syntax recognition [🚀esl-media-query]: (POC) consider out of the box support for esl-media-query-list syntax recognition May 6, 2024
@ala-n ala-n added needs assignee and removed waits triage Issue that waits to be reviewed and handled under discussion labels May 6, 2024
@fshovchko fshovchko self-assigned this May 29, 2024
@ala-n ala-n added the feature New feature label Jul 16, 2024
@ala-n
Copy link
Collaborator Author

ala-n commented Jul 22, 2024

🎉 This issue has been resolved in version 5.0.0-beta.25 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

3 participants