0.1.127 • Published 6 years ago

better-stylekit v0.1.127

Weekly downloads
516
License
-
Repository
-
Last release
6 years ago

Better Stylekit

npm

See usage

Better Stylekit example website

Installation

npm install better-stylekit

Contributing

Browser support

Stylekit components (CSS and JS) should work in following browsers:

  • Chrome 58 or newer
  • Safari 11 (Desktop), 11 and 10 for iOS (revisit in two months)
  • Firefox 57 and newer
  • Edge 16 and newer

CSS

JavaScript

  • Assume ES6 environment
  • Assume DOM4 environment
  • Polyfill when in doubt
  • Prefer leaving library integrations to the user rather than vendoring/bundling them

Components

  • Make sure each component has at least one customizable data-qa attribute
    • Put the qa attribute on the form element (<select>, <input>, etc.) directly, if the component is simple
    • For complex components with multiple inputs, put the qa attribute on the parent and add non-customizable qa attributes for the child inputs. For example, if there is a two-choice toggle component, add a customizable qa attribute to the main parent element, and qa attributes like "choice-1", "choice-2" to the proper inputs.
  • Always include a type for <button> tags
  • Always include a role attribute where it makes sense
  • Sass mixins shared across different components should be in a shared file
  • Set sensitive to add the bsk-Field--sensitive class so the field is obscured in FullStory: {{bsk-field sensitive=true ...}}

Usage

Using the stylekit as an artifact

  1. npm install the stylekit.
  2. Add stylekit/dist/*.css, stylekit/dist/*.js, and stylekit/fonts/* to your build pipeline.
  3. Add stylekit-web.css or stylekit-web.min.css to your page as a stylesheet.
  4. Add stylekit-web.js or stylekit-web.min.js to your page as a script.
  5. Make sure the stylekit fonts are accessible under fonts/ in your CSS directory.

You can use the stylekit JS via the global BetterStylekit object.

Using the stylekit as a library

Ember

npm install ember-better-stylekit

See the ember-better-stylekit README for more details.

Components

ComponentHTML + CSSJSEmberReact
Button
Card
CardList
Dropdown
RadioList
Checkbox
Field
FieldSet
Range
Toggle
Tabs
Modal

✌ = not necessary

Development

  • BSK refers to your local /stylekit
  • ESK refers to your local /stylekit/ember-better-stylekit
  • Better Stylekit refers to the published NPM package

IMPORTANT: CSS changes made in BSK do not automatically update the styles of ESK. ESK uses Better Stylekit for it's styling. In order to have BSK css changes propagate without having to publish to NPM check the Building CSS Changes section below.

Using BSK or ESK in Mortgage

  • In order to access BSK and ESK in /mortgage/frontend, you will need to add symlinks: to set up: run make add-bsk-esk-to-mortgage-symlinks in BSK to teardown: run make rm-bsk-esk-to-mortgage-symlinks in BSK
  • The above commands will create symlinks to BSK and ESK in /mortgage/frontend/node_modules.

Building CSS changes

  • You will need to create a symlink in /stylekit/ember-better-stylekit/node_modules/better-stylekit that points to your local stylekit/src:

    • to set up: run make add-bsk-to-esk-css-symlink in BSK
    • to teardown: run make rm-bsk-to-esk-css-symlink in BSK
  • Stylekit CSS changes should be picked up when you run npm run build in BSK

  • If you prefer a watcher, use npm start in BSK

Test

  • There are visual tests for components. The visual tests work this way:
    1. build the project, which creates previews of components
    2. use puppeteer to open the preview html and take a screenshot
    3. Use node-resemble-js to report any differences between the screenshot and a baseline screenshot
    4. A diff screenshot will be generated if necessary to highlight issues
  • Since screenshots are os/browser dependent, the visual test will only pass in the docker environment
  • To run the visual tests invoke make test in the root of stylekit
  • When you add a new component, add a baseline screenshot and enable the component within the visual test
  • When you change a component, update the baseline screenshot
  • To add or update a baseline screenshot:
    1. run make component=yourComponentName generate-baseline for example: make component=dropdown generate-baseline
    2. when that command is finished, you should see a new baseline screenshot in stylekit/src/test/visual/baseline-screenshot that you can check in

Release

Automated

  • Patch release: make release
  • Minor release (rare): make release-minor

Manual

  • Commit all relevant changes
  • Run npm version patch or npm version minor depending on type of release
  • Run npm install to ensure latest bundled deps are included
  • Run npm run build so the new version is baked in
  • Commit changes as the new version commit
  • Login with npm login using the better account (ask someone to share it with you via LastPass)
  • Run npm publish

Roadmap

  • Ability to add a message to a field
  • Generic field set support
  • Error state with clearable ability
  • Document Field API
  • Grid and form component
  • Add /index.js and other root-level files to simplify library integration
  • React/Preact library integration
  • Consider Lerna for monorepo management
  • Ember/Preact component generation from one source of truth
0.1.127

6 years ago

0.1.126

6 years ago

0.1.125

6 years ago

0.1.124

6 years ago

0.1.123

6 years ago

0.1.122

6 years ago

0.1.121

6 years ago

0.1.120

6 years ago

0.1.119

6 years ago

0.1.118

6 years ago

0.1.117

6 years ago

0.1.116

6 years ago

0.1.115

6 years ago

0.1.114

6 years ago

0.1.113

6 years ago

0.1.112

6 years ago

0.1.111

6 years ago

0.1.110

6 years ago

0.1.109

6 years ago

0.1.108

6 years ago

0.1.107

6 years ago

0.1.106

6 years ago

0.1.105

6 years ago

0.1.105-rc1

6 years ago

0.1.104

6 years ago

0.1.104-rc1

6 years ago

0.1.103

6 years ago

0.1.102

6 years ago

0.1.101

6 years ago

0.1.100

6 years ago

0.1.100-rc1

6 years ago

0.1.99

6 years ago

0.1.98

6 years ago

0.1.98-rc1

6 years ago

0.1.97

6 years ago

0.1.97-rc1

6 years ago

0.1.96

6 years ago

0.1.96-rc1

6 years ago

0.1.95

6 years ago

0.1.95-rc1

6 years ago

0.1.94

6 years ago

0.1.94-rc1

6 years ago

0.1.93

6 years ago

0.1.92

6 years ago

0.1.91

6 years ago

0.1.91-rc1

6 years ago

0.1.90

6 years ago

0.1.89

6 years ago

0.1.88

6 years ago

0.1.87

6 years ago

0.1.86

6 years ago

0.1.85

6 years ago

0.1.84-rc.1

6 years ago

0.1.84

6 years ago

0.1.83

6 years ago

0.1.82

6 years ago

0.1.81

6 years ago

0.1.80

6 years ago

0.1.79

6 years ago

0.1.78

6 years ago

0.1.77

6 years ago

0.1.76

6 years ago

0.1.75

6 years ago

0.1.74

6 years ago

0.1.73

6 years ago

0.1.72

6 years ago

0.1.71

6 years ago

0.1.70

6 years ago

0.1.70-rc1

6 years ago

0.1.69

6 years ago

0.1.68

6 years ago

0.1.66

6 years ago

0.1.65-rc2

6 years ago

0.1.65-rc1

6 years ago

0.1.64

6 years ago

0.1.63

6 years ago

0.1.62

6 years ago

0.1.62-rc.1

6 years ago

0.1.61

6 years ago

0.1.60

6 years ago

0.1.60-rc.1

6 years ago

0.1.59

6 years ago

0.1.59-rc1

6 years ago

0.1.58

6 years ago

0.1.57

6 years ago

0.1.56

6 years ago

0.1.55

6 years ago

0.1.54

6 years ago

0.1.53

6 years ago

0.1.52

6 years ago

0.1.51

6 years ago

0.1.50-rc1

6 years ago

0.1.50

6 years ago

0.1.49

6 years ago

0.1.48

6 years ago

0.1.47

6 years ago

0.1.46

6 years ago

0.1.45

6 years ago

0.1.44

6 years ago

0.1.43

6 years ago

0.1.42

6 years ago

0.1.41

6 years ago

0.1.40

6 years ago

0.1.39-r6

6 years ago

0.1.39-r5

6 years ago

0.1.39-r4

6 years ago

0.1.39-r3

6 years ago

0.1.39-r2

6 years ago

0.1.39-r1

6 years ago

0.1.39

6 years ago

0.1.38

6 years ago

0.1.37

6 years ago

0.1.36

6 years ago

0.1.35

6 years ago

0.1.34

6 years ago

0.1.33

6 years ago

0.1.32

6 years ago

0.1.32-rc.4

6 years ago

0.1.32-rc.3

6 years ago

0.1.32-rc.2

6 years ago

0.1.32-rc.1

6 years ago

0.1.31

6 years ago

0.1.29

6 years ago

0.1.28

6 years ago

0.1.27

6 years ago

0.1.27-rc.3

6 years ago

0.1.27-rc.2

6 years ago

0.1.27-rc.1

6 years ago

0.1.2-7.rc-1

6 years ago

0.1.26

6 years ago

0.1.26-rc.1

6 years ago

0.1.25

6 years ago

0.1.25-rc.4

6 years ago

0.1.25-rc.3

6 years ago

0.1.25-rc.2

6 years ago

0.1.25-rc.1

6 years ago

0.1.24

6 years ago

0.1.22

6 years ago

0.1.21

6 years ago

0.1.20

6 years ago

0.1.19

6 years ago

0.1.18

6 years ago

0.1.17

6 years ago

0.1.16

6 years ago

0.1.15

6 years ago

0.1.14

6 years ago

0.1.13

6 years ago

0.1.12

6 years ago

0.1.11

6 years ago

0.1.10

6 years ago

0.1.9

6 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago