Comments (3)
Now I got what you mean. In other words you want to use in jss some specific pseudo selectors and map them to corresponding classes when generating css. This is a good use case for a plugin.
from jss.
I also want the plugin to inject javascript to give to the browser, and not simply css. I could do that with a plugin?
Extending :click further, I can even imagine it taking parameters:
:click(
btn: right, // mouse button used
dur: 1.5s, // time a pointer is held down on a click (perhaps min and max duration)
drg: left, // the direction of movement after a click is begun
off: #bar, // the id/class/tag element the point ends on when click-off
dst: 100px, // distance the pointer movement travels before click-off
cnt: 2 // number of clicks, 2 means double-click
)
By the way, here is some "dream code" that eventually I'd like to be able to use (or perhaps an extended jss syntax). It is a hybrid of js events/logic with css. I think with such a robust language, a developer could implement the vast majority of UI/UX stuff.
body {
font-size: small;
background: #fff;
color: #222;
[data-role="blah"] {
[data-attr]: 132px; /* attribute string manipulation */
div .foo color: #333;
}
#my-app {
#foo:hover {
[data-bazbar]++; /* attribute data arithmatic */
}
.bar {
(.foo[data-bar] <= 500) { // basic if/then logic being used here
[data-blah]: 12;
[style border]: red;
// the "^" character points to top (root) page element,
// so that child element events can modify any other element
^ #myapp > div [style color]: blue;
}
&:active {
.something [style border, background]: blue; // this is the same ...
.something { border : blue; background: blue } // ... as this.
}
.someclass (height >= 2000) [style border, color]: green;
&:parent {
color: purple;
font-size: 24px;
}
#baz:click {
// new operators:
#foo .someclass [data-foo]~: large;
.someclass [data-*]: 200;
.foo [data-bar] -= 12;
.foo [data-bar] /= 12;
.foo [data-bar] *= 12;
.foo [data-bar] %= 12;
.foo class &= large; } // toggle on
.foo class ^= large; } // toggle off
.foo class ~= large; } // toggle opposite
}
}
}
I'd love to see less need for writing javascript, and more use of a "CSS" style language that can deal with style, logic, events, attributes. Attribute manipulation is important to me, because it would allow Polymer-style elements to be controlled easily by manipulating HTML tag attributes as if they are simply variables. (BTW, I prefer the look of CSS to JSON, because it doesn't need so many brackets and braces--it looks better.)
from jss.
This is definitely out of jss scope. JSS core should stay really fast. Thats why I even moved plugins to separate repositories and removed them from core. What you are talking about is a task for a framework on top of jss.
from jss.
Related Issues (20)
- [cli] stdout is not a tty HOT 1
- get error msg in Micro-frontend environment: Cannot read properties of null (reading 'cssRules') HOT 3
- Support @container query HOT 9
- dynamic css issue under a certain condition since version 10.9.1-alpha.1 HOT 2
- Support @layer property HOT 2
- Re-rendering root node breaks dynamic styles HOT 10
- Docs are not able to load github's markdown files
- Bug with react-jss compilation: "Warning: [JSS] Rule is not linked. Missing sheet option "link: true"."
- TypeError: Cannot read properties of null (reading 'deleteRule')
- JSS for Preact
- React strict mode forces dynamic rules to be added twice which breaks hydration
- Code Execution Error after Applying Content Security Policy (CSP)
- Style block un-renders when any param used - since v10.0 HOT 1
- `react-jss` dynamic rules memory leak in strict mode
- StyleSheet.replaceRule does not replace media query rules
- How should i assign a counters() to the content property?
- Add specific id or data-tag to the style element injected in head?
- Reference another stylesheet
- Wrong order for generated nested styles
- [react-jss] not support `next` app router mode
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jss.