• Stars
    star
    1,267
  • Rank 37,138 (Top 0.8 %)
  • Language
    TypeScript
  • License
    Apache License 2.0
  • Created about 6 years ago
  • Updated 28 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Spectrum Web Components

Who are we?

Spectrum Web Components is a future-looking project to develop Adobe Spectrum design language based around web components, ES-Modules, and modern browser standards.

To this end, Spectrum Web Components only targets modern, evergreen browsers that fully implement the Custom Elements V1 specification, e.g. Chrome, Firefox, Safari. Polyfills will be avoided as much as possible but documented if necessary.

Requirements

  • NodeJS >= 14.15.3
  • Typescript
  • Browsers with Custom Elements V1 and Shadow DOM support, e.g. Chrome, Firefox, Safari, Edge (79+)
    • Or appropriate polyfills in older browsers.

Getting started

git clone https://github.com/adobe/spectrum-web-components.git
cd spectrum-web-components
yarn

The call to yarn will install and setup everything you need for developing and running the packages in this library.

Typical development will involve running yarn storybook, yarn test, and yarn docs:start if you're making documentation changes (see below for additional details).

Building a new component

Creating a new component from the command line can be done by running the following:

$ yarn new-package

This will scaffold your component's required architecture by prompting you for 2 data points - the desired name for your package and the name of the Spectrum CSS asset from which you will be building.

? SWC package name (i.e. color-area)

Note that your component name should be provided in kebab case and should relate as closely as possible to the Spectrum core naming.

? Spectrum CSS package name (i.e. colorarea)

You can find this information in the Spectrum CSS GitHub project by finding the component package.json (i.e., components/accordion/package.json)

For additional information, please see the generating components documentation and capturing the value of the package name: "name": "@spectrum-css/accordion". In this example, that name is accordion. Note that the project scope @spectrum-css is stripped out of the response.

Storybook

Testing & reviewing changes can be done using the Storybook instance. Running yarn storybook will spin up a local instance of Storybook, triggering the browser to open at completion. From there you can make changes to your code and the browser will automatically refresh.

You can run Storybook through the command:

yarn storybook

By default, the resulting site will be available at http://localhost:8000.

Documentation

The Spectrum Web Components documentation site is available via the following command:

yarn docs:start

By default, the resulting site will be available at http://localhost:8080.

In the case that you'd like to serve and test a static build of the documentation from the root directory (localhost or otherwise), use:

yarn docs:build

Updating Spectrum CSS

There are two mechanisms for broadly updating SWC's Spectrum CSS dependencies:

  • yarn update:spectrum-css brings all Spectrum CSS dependencies to 'latest'
  • yarn update:spectrum-css:nonbreaking brings them to the latest minor or patch version

We aim to keep Spectrum CSS as current as possible, to track the Spectrum design system closely. The :nonbreaking variant lets us release patch updates quickly in cases where more work is required to be compatible with 'latest.'

Advanced development

There are several commands that can be useful in specific scenarios:

  • yarn build:clear-cache to remove previously created artifacts of the tsc build process.
  • yarn spectrum-vars to ensure that theme files are up-to-date.
  • yarn process-icons to make sure that the most recent icons are included.
  • yarn process-spectrum to process the spectrum CSS style sources into the individual packages.
  • yarn build to make sure the available JS has been built from the current TS source.

Linting

The project will be linted on a pre-commit hook, but you can also run the lint suite with yarn lint. It uses ESLint to lint the JS / TS files, and StyleLint to lint the CSS files.

Dependency linting

There are downstream issues that can arise from multiple packages in this mono-repo using dependencies with mismatching version strings. This is particularly an issue for dependencies below 1.0.0 but can be exacerbated in that context and others by more strict settings that can be applied in various package managers. By default, Lerna will bump version numbers of internal dependencies when the various packages are published and the depended version is pointing to the latest release, which can help to mitigate this issue. This can be further mitigated by using ^0.0.0 structured dependency versions, the ^ allowing for the highest amount of upward flexibility in satisfying the dependency. When using these version strings, yarn lint:versions which ensure that all instances of those strings for the same dependency match across the repo.

yarn list:versions --fix will reach into the package.json files and update all dependencies to the latest version available in the library, a possibly dangerous operation. If you know this is what you want to do when there are mismatched versions found by yarn lint:versions, this can make greatly shorten the amount of work to catch the versions up to each other.

Testing

Unit tests

Unit tests are run with Web Test Runner in Playwright using the Chai, Mocha and Sinon helper libraries. These tests can be executed with:

yarn test

During development you may wish to use yarn test:watch to automatically build and re-run the test suites.

Screenshot testing

Note: visual regression is done automatically on pull requests via CircleCI; however, the following outlines how you can run these tests local to your machine.

Visual regressions are tracked via screenshot testing powered by @web/test-runner-visual-regression. Due to the font metrics not being identical, it is difficult to rely on screenshot-based testing across operating systems. Because of this, the library manages its golden image cache internal to CircleCI, rather than as a part of the git repository. Neither the screenshots-baseline nor screenshots-actual directory should be added to git. When working with visual regression tests locally to manage changes you are making, be sure to create a baseline locally before you begin development (alternatively, you can pull down the main branch to generate the baselines for your in-progress work).

To create a local baseline for comparing your changes to later in the development cycle, use the following:

yarn test:visual:clean # start with a clean slate
# yarn test:visual:clean:baseline # removes only baseline images
# yarn test:visual:clean:current # removes only images updated in the most recent test pass

# To enable comparison, it is generally recommended to generate baselines on the main branch.
yarn test:visual vrt-${component name} --update-visual-baseline
eg: yarn test:visual vrt-accordion --update-visual-baseline

# Running the tests on the local branch
yarn test:visual vrt-${component name}
eg: yarn test:visual vrt-accordion

# Running the tests of light medium ltr
yarn test:visual vrt-${component name}-single
eg: yarn test:visual vrt-accordion-single

Screenshot coverage

Visual regression testing is done against screens derived from the exports of the *.stories.js files in each package. As you add packages or story files to existing packages, they will automatically be added to the visual regression suite and will require updating the cache key (outlined below).

Keeping CI assets updated

If you find the visual-* jobs failing on CircleCI for reasons that you expect (you've updated the Spectrum CSS dependencies, you've added new tests, etc.) then you will need to update the golden images cache key before your build will pass. You can review and share the diffs for a test pass via a URL shaped like vrt--spectrum-web-components.netlify.app/${branchName}. Before updating the cache key, be sure that the updated caches are both complete (there are times when process errors prevent images from being correctly created or when certain test passes take longer than others) and appear as expected. If you agree with the updated cache content, update the golden images cache key as follows.

Your failing branch will have created a new cache with a key of v1-golden-images-{{ .Revision }}-<< parameters.regression_color >>-<< parameters.regression_scale >>-<< parameters.dir >>-{{ epoch }}. Here {{ .Revision }} outlines the git commit hash of the current CI pass. In .circleci/config.yml, you will use that to update the cache that is requested at the beginning of the run-regressions job. As part of the review site, the git commit hash will be listed in the side navigation UI for easy access, use this number to update the current_golden_images_hash paramater that appears as follows:

parameters:
    current_golden_images_hash:
        type: string
        default: ${UPDATE_REVISION_NUMBER_HERE}

This will ensure that tests on this branch point to this cache key for at least the next 30 days (keep-alive time of caches on CircleCI). Once the branch is merged to main, a cache key of v2-golden-images-main-<< parameters.regression_color >>-<< parameters.regression_scale >>-<< parameters.regression_dir >>-{{ epoch }} will be created on each successful build of main that will be long-lived and act as the "fallback" once the revision keyed cache has expired.

Benchmarking

You can acquire current runtimes for the individual elements with:

yarn build:tests
yarn test:bench

This will run the defined Tachometer tests and report the current runtime cost of each individual element. When not making changes to the benchmarks on your local machine, you can skip yarn build:tests for later passes.

Anatomy of a component

There is extended documentation on adding a new component to the library in the documentation site. However, at a high level, you will be building the following structure:

  • packages
    • new-component-name
      • src
        • index.ts
        • new-component-name.css
        • new-component-name.ts
        • spectrum-config.js
        • spectrum-new-component-name.css
      • stories
        • new-component-name.stories.ts
      • test
        • benchmark
          • test-basic.ts
        • new-component-name.test.ts
      • package.json
      • README.md
      • tsconfig.json

For a list of component waiting to be implemented, visit our missing components tag.

IDE Notes

The build process compiles .css files using PostCSS and wraps them in the lit-html css template tag and writes out a .css.ts file for easy import into TypeScript files. This file should not be edited, and is ignored by .gitignore, but you may also wish to hide the files in your IDE.

Contributing

We'd be very grateful if you contributed to the project! Check out our contribution guidelines for more information.

Active patches

lru-cache

The lru-cache leveraged by @web/dev-server can interact negatively with ARM based macOS machines causing a critical hang in the cache of transpiled file responses. This only effects development time operations and specifically effects the local test passes. To avoid this [email protected] has been patched to make its set method a noop, avoiding the caching process all together.

More Repositories

1

brackets

An open source code editor for the web, written in JavaScript, HTML and CSS.
JavaScript
33,258
star
2

react-spectrum

A collection of libraries and tools that help you build adaptive, accessible, and robust user experiences.
TypeScript
12,850
star
3

leonardo

Generate colors based on a desired contrast ratio
JavaScript
1,952
star
4

antialiased-cnns

pip install antialiased-cnns to improve stability and accuracy
Python
1,611
star
5

balance-text

A plugin for implementing balancing of wrapping text in a web page
JavaScript
1,362
star
6

adobe.github.com

Adobe central hub for open source
CSS
1,290
star
7

spectrum-css

The standard CSS implementation of the Spectrum design language.
CSS
1,196
star
8

brackets-shell

CEF3-based application shell for Brackets.
Python
1,176
star
9

aem-core-wcm-components

Standardized components to build websites with AEM.
Java
741
star
10

S3Mock

A simple mock implementation of the AWS S3 API startable as Docker image, TestContainer, JUnit 4 rule, JUnit Jupiter extension or TestNG listener
Java
699
star
11

jsonschema2md

Convert Complex JSON Schemas into Markdown Documentation
JavaScript
594
star
12

NLP-Cube

Natural Language Processing Pipeline - Sentence Splitting, Tokenization, Lemmatization, Part-of-speech Tagging and Dependency Parsing
HTML
551
star
13

aem-project-archetype

Maven template to create best-practice websites on AEM.
JavaScript
544
star
14

ferrum

Features from the rust language in javascript: Provides Traits/Type classes & a hashing infrastructure and an advanced library for working with sequences/iterators in js
JavaScript
496
star
15

cryptr

Cryptr: a GUI for Hashicorp's Vault
HTML
495
star
16

brackets-app

Deprecated CEF1-based app shell for Brackets. Use https://github.com/adobe/brackets-shell instead.
C++
490
star
17

cssfilterlab

CSS FilterLab
JavaScript
348
star
18

hyde

A front-end to Jekyll that parses C++ sources to produce and enforce out-of-line documentation
C++
303
star
19

htl-spec

HTML Template Language Specification
280
star
20

node-smb-server

A 100% JavaScript implementation of the SMB file sharing protocol.
JavaScript
276
star
21

lit-mobx

Mixin and base class for using mobx with lit-element
TypeScript
268
star
22

aem-guides-wknd

Tutorial Code companion for Getting Started Developing with AEM Sites WKND Tutorial
JavaScript
261
star
23

xdm

Experience Data Model
JavaScript
245
star
24

lagrange

A Robust Geometry Processing Library
C++
215
star
25

webkit

Experiments and contributions to WebKit. Tracks git://git.webkit.org/WebKit.git
213
star
26

chromium

Experiments and contributions to Chromium project
C++
207
star
27

elixir-styler

An @elixir-lang code-style enforcer that will just FIFY instead of complaining
Elixir
207
star
28

avmplus

Source code for the Actionscript virtual machine
ActionScript
194
star
29

ops-cli

Ops - cli wrapper for Terraform, Ansible, Helmfile and SSH for cloud automation
Python
186
star
30

rules_gitops

This repository contains rules for continuous, GitOps driven Kubernetes deployments.
Starlark
168
star
31

Deep-Audio-Prior

Audio Source Separation Without Any Training Data.
Python
156
star
32

pdf-embed-api-samples

Samples for Adobe Document Services PDF Embed API
JavaScript
155
star
33

svg-native-viewer

SVG Native viewer is a library that parses and renders SVG Native documents
C++
152
star
34

aem-htl-repl

Read–Eval–Print Loop environment for HTL.
JavaScript
152
star
35

OSAS

One Stop Anomaly Shop: Anomaly detection using two-phase approach: (a) pre-labeling using statistics, Natural Language Processing and static rules; (b) anomaly scoring using supervised and unsupervised machine learning.
Python
150
star
36

stringlifier

Stringlifier is on Opensource ML Library for detecting random strings in raw text. It can be used in sanitising logs, detecting accidentally exposed credentials and as a pre-processing step in unsupervised ML-based analysis of application text data.
Python
148
star
37

Spry

Spry is a JavaScript-based framework that enables the rapid development of Ajax-powered web pages.
HTML
140
star
38

XMP-Toolkit-SDK

The XMP Toolkit allows you to integrate XMP functionality into your product or solution
C++
135
star
39

himl

A hierarchical yaml config in Python
Python
118
star
40

aem-boilerplate

Use this repository template for new AEM projects.
JavaScript
118
star
41

adobe-client-data-layer

An event-driven store for all trackable data of your site.
JavaScript
114
star
42

brackets-phonegap

A brackets extension for PhoneGap development.
JavaScript
112
star
43

aem-component-generator

AEM Component Generator is a java project that enables developers to generate the base structure of an AEM component using a JSON configuration file specifying component and dialog properties and other configuration options.
Java
111
star
44

brackets.io

brackets.io website
HTML
111
star
45

tf-manage

Shell
110
star
46

coral-spectrum

A JavaScript library of Web Components following Spectrum design patterns.
JavaScript
108
star
47

GLS3D

An implementation of OpenGL for Stage3D that can run inside Flash Player 11+
C
105
star
48

aem-core-cif-components

A set of configurations and components to get you started with AEM Commerce development
Java
103
star
49

react-webcomponent

This projects automates the wrapping of a React component in a CustomElement.
JavaScript
95
star
50

ride

REST API Automation framework for functional, integration, fuzzing, and performance testing
Java
93
star
51

alloy

Alloy is the web SDK for the Adobe Experience Platform.
JavaScript
92
star
52

spectrum-tokens

Tokens used by Spectrum, Adobe's design system.
JavaScript
90
star
53

web-platform

JavaScript
90
star
54

asset-share-commons

A modern, open-source asset share reference implementation built on Adobe Experience Manager (AEM)
Java
88
star
55

experience-platform-postman-samples

83
star
56

go-starter

Bootstrap a new project from a template.
Go
83
star
57

orc

ORC is a tool for finding violations of C++'s One Definition Rule on the OSX toolchain.
C++
79
star
58

pdfservices-node-sdk-samples

Samples for the Adobe Document Services PDF Tools Node SDK
HTML
77
star
59

sbmc

Sample-based Monte Carlo Denoising using a Kernel-Splatting Network [Siggraph 2019]
Python
76
star
60

git-server

A GitHub Protocol & API emulation
JavaScript
75
star
61

aio-theme

The Adobe I/O theme for building markdown powered sites
JavaScript
72
star
62

aem-guides-wknd-spa

71
star
63

aem-sample-we-retail-journal

We.Retail Journal is a sample showcasing SPA Editing capabilities in AEM using React and Angular
CSS
70
star
64

frontend-regression-validator

Visual regression tool used to compare baseline and updated instances of a website in a deployment pipeline.
Python
67
star
65

blackhole

An HTTP sink (for testing) with optional recording and playback ability
Go
65
star
66

react-spectrum-charts

Build compelling visualizations using declarative react components.
TypeScript
61
star
67

aem-spa-project-archetype

Maven Archetype for creating new AEM SPA projects
CSS
61
star
68

aio-cli

Adobe I/O Extensible CLI
JavaScript
60
star
69

aem-react-editable-components

SPA React Editable Components for Adobe Experience Manager
TypeScript
60
star
70

aem-upload

Makes uploading to AEM easier, and can be used as a command line executable or required as a Node.js module.
JavaScript
60
star
71

dds2atf

Tool for converting DDS files into ATF files suitable for use with the Flash Stage3D API
C++
58
star
72

redux-saga-promise

Create actions that return promises, which are resolved/rejected by a redux saga
JavaScript
58
star
73

aem-modernize-tools

A suite of tools to modernize your AEM Sites implementations off legacy features.
Java
58
star
74

adobe-photoshop-api-sdk

Adobe Photoshop API SDK
JavaScript
57
star
75

helix-home

The home of Project Helix
HTML
54
star
76

xmp-docs

XMP documentation
52
star
77

aem-testing-clients

Testing tools for Adobe Experience Manager
Java
51
star
78

aem-brackets-extension

Brackets extension for Adobe Experience Manager (AEM) front-end developers with auto-sync and HTL support.
JavaScript
51
star
79

aem-enablement

Content required for AEM Enablement
Java
50
star
80

brackets-edge-web-fonts

Edge Web Fonts extension for Brackets. Simply unzip and drop into your Brackets extension folder to browse and include Edge Web Fonts.
JavaScript
50
star
81

helix-cli

Command-line tools for developing with AEM
JavaScript
49
star
82

aem-guides-wknd-graphql

JavaScript
49
star
83

brackets-registry

A registry system for hosting Brackets extensions powered by node.js
JavaScript
46
star
84

htlengine

An HTL (Sightly) Interpreter/Compiler for Node.js
HTML
45
star
85

aem-dispatcher-experiments

Experiments to demonstrate the impact of the Dispatcher and it's configuration parameters.
HTML
44
star
86

pdfservices-python-sdk-samples

Adobe PDFServices python SDK Samples
Python
44
star
87

commerce-cif-connector

AEM Commerce connector for Magento and GraphQL
Java
43
star
88

node-fetch-retry

Node Module for performing retries using node-fetch
JavaScript
42
star
89

aem-react-core-wcm-components

41
star
90

behavior_tree_editor

A visual editor for building behavior trees for the bots
JavaScript
41
star
91

libLOL

Python
40
star
92

starter-repo

Documentation templates for use in open source and open development projects
40
star
93

commerce-cif-magento

Adobe Commerce Integration Framework (CIF) Magento Integration
JavaScript
40
star
94

aem-cif-guides-venia

AEM CIF Venia Project
JavaScript
39
star
95

bin2c

Convert to/Embed binary files in C source files, quickly and efficiently.
C
38
star
96

aem-site-template-standard

Basic site template for AEM that allows non-Java experts to create new sites by customizing CSS and JS only.
SCSS
37
star
97

aio-cli-plugin-cloudmanager

Cloud Manager plugin for the Adobe I/O CLI
JavaScript
37
star
98

graphicalweb-keynote

Keynote for Graphical Web Conference
JavaScript
37
star
99

oss-contributors

How do tech companies rank amongst themselves when it comes to github.com activity?
JavaScript
35
star
100

aem-spa-page-model-manager

Interface between Adobe Experience Manager and Single Page Application framework.
TypeScript
35
star