MCPcopy
hub / github.com/threepointone/glamor

github.com/threepointone/glamor @v3.0.0-3 sqlite

repository ↗ · DeepWiki ↗ · release v3.0.0-3 ↗
525 symbols 1,364 edges 91 files 10 documented · 2%
README

glamor

css in your javascript

hand rolled by @threepointone, @donaldpipowitch, @otbe, and @ChristopherBiscardi

Join the chat at https://gitter.im/glamor-css/Lobby

Build Status

npm install glamor --save

usage

import { css } from 'glamor'

// make css rules
let rule = css({
  color: 'red',
  ':hover': {
    color: 'pink'
  },
  '@media(min-width: 300px)': {
    color: 'green',
    ':hover': {
      color: 'yellow'
    }
  }
})

// add as data attributes



  zomg




// or as classes



  zomg




// merge rules for great justice
let mono = css({
  fontFamily: 'monospace'
})

let bolder = css({
  fontWeight: 'bolder'
})




  bold code!




motivation

This expands on ideas from @vjeux's 2014 css-in-js talk. We introduce an api to annotate arbitrary dom nodes with style definitions ("rules") for, um, the greater good.

features

  • fast / efficient, with a fluent api
  • ~8k gz, including the prefixer
  • framework independent
  • adds vendor prefixes / fallback values
  • supports all the pseudo :classes/::elements
  • @media queries
  • @supports statements
  • @font-face / @keyframes
  • escape hatches for parent / child / contextual selectors
  • dev helper to simulate pseudo classes like :hover, etc
  • server side / static rendering
  • tests / coverage
  • experimental - write real css, with syntax highlighting and linting

(thanks to BrowserStack for providing the infrastructure that allows us to run our build in real browsers.)

docs

extras

Every extra is available as a standalone package. - glamor-reset - include a css reset - glamor-react - helpers for themes, @vars - use a css prop on all your react elements - glamor-jsxstyle - react integration, à la jsxstyle - glamor-aphrodite - shim for aphrodite stylesheets - glamor-utils - a port of postcss-utilities - glamor-server - server side rendering - glamor-raw-css - write real css - glamor-ous - a port of the skeleton css framework - glamor-styled - an experimental port of styled-components - jest-glamor-react - get glamor's styles in your Jest snapshots

speedy mode

there are two methods by which the library adds styles to the document - - by appending css 'rules' to a browser backed stylesheet. This is really fast, but has the disadvantage of making the styles uneditable in the devtools sidebar. - by appending text nodes to a style tag. This is fairly slow, but doesn't have the editing drawback.

as a compromise, we enable the former 'speedy' mode NODE_ENV=production, and disable it otherwise. You can manually toggle this with the speedy() function.

characteristics

while glamor shares most common attributes of other inline style / css-in-js systems, here are some key differences -

  • uses 'real' stylesheets, so you can use all css features.
  • rules can be used as data-attributes or classNames.
  • simulate pseudo-classes with the simulate helper. very useful, especially when combined when hot-loading and/or editing directly in devtools.
  • really fast, by way of deduping rules, and using insertRule in production.

todo

profit, profit

I get it

Extension points exported contracts — how you extend this code

DeconstrucedStyles (Interface)
(no doc)
packages/glamor/src/css/index.ts
CSSProperties (Interface)
(no doc)
packages/glamor/src/css/index.ts
StyleAttribute (Interface)
(no doc)
packages/glamor/src/css/index.ts

Core symbols most depended-on inside this repo

peg$fail
called by 346
packages/glamor-raw-css/src/spec.js
peg$parseS
called by 130
packages/glamor-raw-css/src/spec.js
peg$parsecomment
called by 84
packages/glamor-raw-css/src/spec.js
peg$literalExpectation
called by 80
packages/glamor-raw-css/src/spec.js
css
called by 68
packages/glamor/src/index.ts
insert
called by 57
packages/glamor/src/StyleSheet.ts
peg$parsestub
called by 38
packages/glamor-raw-css/src/spec.js
render
called by 36
packages/glamor-react/example/src/vars.js

Shape

Function 395
Class 68
Method 59
Interface 3

Languages

TypeScript100%

Modules by API surface

packages/glamor-raw-css/src/spec.js214 symbols
packages/glamor-raw-css/src/index.js28 symbols
packages/glamor-raw-css/src/babel.js26 symbols
packages/glamor-utils/src/index.js25 symbols
packages/glamor-jsxstyle/src/index.js22 symbols
packages/glamor/src/StyleSheet.ts19 symbols
packages/glamor-react/src/index.js17 symbols
packages/glamor/src/css/index.ts15 symbols
packages/glamor/example/src/transitiongroup.js11 symbols
packages/glamor-autoprefixer/src/index.js11 symbols
packages/glamor/example/src/perf.js9 symbols
packages/glamor/src/index.ts8 symbols

Dependencies from manifests, versioned

@types/expect1.20.1 · 1×
@types/mocha2.2.41 · 1×
@types/node7.0.18 · 1×
babel-cli6.24.1 · 1×
babel-core6.24.1 · 1×
babel-loader7.0.0 · 1×
babel-plugin-transform-decorators-legacy1.3.4 · 1×
babel-polyfill6.23.0 · 1×
babel-preset-es20156.24.1 · 1×
babel-preset-react6.24.1 · 1×
babel-preset-stage-06.24.1 · 1×
caniuse-api2.0.0 · 1×

For agents

$ claude mcp add glamor \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact