All Projects → tomhodgins → qss

tomhodgins / qss

Licence: MIT License
QSS ➸ a simple query syntax for CSS element queries

Programming Languages

HTML
75241 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to qss

Astq
Abstract Syntax Tree (AST) Query Engine
Stars: ✭ 89 (+3.49%)
Mutual labels:  syntax, query
Eqcss
EQCSS is a CSS Reprocessor that introduces Element Queries, Scoped CSS, a Parent selector, and responsive JavaScript to all browsers IE8 and up
Stars: ✭ 1,513 (+1659.3%)
Mutual labels:  element-queries, css-reprocessor
syntax-atom
An Atom dark theme inspired by Framer’s popular code editor.
Stars: ✭ 22 (-74.42%)
Mutual labels:  syntax
tree-sitter-sql
SQL syntax highlighting for tree-sitter
Stars: ✭ 33 (-61.63%)
Mutual labels:  syntax
Query-Tool
The QueryTool is a library that allows easier and faster connections with Postgres databases. Whit it, you can make insertions, selections, updates and deletions in the database in a simple and effective way.
Stars: ✭ 28 (-67.44%)
Mutual labels:  query
active-persistence
Active Persistence is a implementation of Active Record Query Interface for JPA that makes it easy and fun.
Stars: ✭ 14 (-83.72%)
Mutual labels:  query
Minecraft-Server-Status
✅一个用于显示服务器在线信息及其他内容的网站
Stars: ✭ 22 (-74.42%)
Mutual labels:  query
sqrs
🚌SQRS is a JavaScript library for implementing CQRS pattern.
Stars: ✭ 23 (-73.26%)
Mutual labels:  query
see-cli
A colorful 🌈 cat - syntax highlight print CLI
Stars: ✭ 24 (-72.09%)
Mutual labels:  syntax
jellex
TUI to filter JSON and JSON Lines data with Python syntax
Stars: ✭ 41 (-52.33%)
Mutual labels:  query
URLQueryItemEncoder
A Swift Encoder for encoding any Encodable value into an array of URLQueryItem.
Stars: ✭ 60 (-30.23%)
Mutual labels:  query
syntaxmaker
The NLG tool for Finnish
Stars: ✭ 19 (-77.91%)
Mutual labels:  syntax
fastedit
安卓端高性能输入框。
Stars: ✭ 38 (-55.81%)
Mutual labels:  syntax
searchable
Pattern-matching search and reusable queries in laravel.
Stars: ✭ 28 (-67.44%)
Mutual labels:  query
micro-code-analyser
A tiny Node.js microservice to detect the language of a code snippet
Stars: ✭ 21 (-75.58%)
Mutual labels:  syntax
ethjs-rpc
A super simple module for making low level queries to the Ethereum RPC layer.
Stars: ✭ 14 (-83.72%)
Mutual labels:  query
go-query
⚡ Blazingly fast query engine
Stars: ✭ 16 (-81.4%)
Mutual labels:  query
TIL
Today I Learned
Stars: ✭ 43 (-50%)
Mutual labels:  query
linqjs
use linq and lambda in javascript on es6, can use linq function in an Object or an Array or a String value | 一个方便对数组、字典、树形数据进行操作、筛选等操作的工具库
Stars: ✭ 17 (-80.23%)
Mutual labels:  query
Git-API
Gets info from github and transfers into json styled data
Stars: ✭ 18 (-79.07%)
Mutual labels:  query

QSS

A Simple Query Syntax for CSS Element Queries

The goal of QSS is to define a simple syntax for specifying element queries by adding a new ending part between a CSS selector list and the block of rules that help define the breakpoints when those rules are to apply.

Normally in CSS you have something like this:

selectorList { block }

We are going to add a new part for our query between the selector list and the block where we will store instructions for when the rule should apply.

selectorList <query> { block }

Because this exists as a new part between the selector list and the block of rules, if you have a list of selectors like h1, h2, h3, h4, h5, h6 {} you only need to add the query once after the selector list is complete, like h1, h2, h3, h4, h5, h6 <query> {} rather than h1 <query>, h2 <query>, h3 <query>, ….

This document describes two different formats for expressing element queries for individual CSS rules, one using an if-based structure, and another that uses the @ symbol to declare when it should apply.

Phrase Formats

1) if <condition> <comparator> <breakpoint>

  • operator: if
  • condition: width | height | characters | children | xscroll | yscroll
  • comparator: < | below | under | <= | max | == | equals | >= | min | > | above | over
  • breakpoint: <number>

Examples

div if width above 500 {}
input if characters under 1 {}

2) @ <comparator> <breakpoint> <condition>

  • operator: @
  • comparator: < | below | under | <= | max | == | equals | >= | min | > | above | over
  • breakpoint: <number>
  • condition: width | height | characters | children | xscroll | yscroll

Examples

div @ above 500 width {}
input @ under 1 characters {}

In both phrase formats the whitespace between tokens is optional, this means that if you prefer to think about these as @above or @min you can express them that way. The following should all equivalent:

div if width >= 500 {}
div if width >=500 {}
div if width min 500 {}
div @min 500 width {}
div@min500width{}
div @ >=500 width {}

How it works

The queries parsed by QSS would be split into the following pieces:

  • selector list
  • rule block (or stylesheet?)
  • comparator
  • condition
  • breakpoint

And these could also be used to construct Element Queries for other syntaxes like:

Essentially QSS acts as a syntax to abstract away writing these: Useful Tests for JS-powered Styling

Plugin Usage

This repository contains a working proof of concept of a plugin to parse and read QSS syntax. In order to use this plugin you just need to include QSS on the page where you want it to display:

<script src=qss.js></script>

Then you're able to add queries written in QSS syntax to your site using one of the following methods: a <style> tag, a <link> tag with type=text/qss set, or a <script> tag with a type of text/qss either inline or linked externally using a src="" attribute:

<style type="text/qss"></style>
<link type="text/qss" href=stylesheet.qss rel=stylesheet>
<script type="text/qss"></script>
<script type="text/qss" src=stylesheet.qss></script>

Links

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].