Merge branch 'develop' into ffi

This commit is contained in:
Simon Binder 2019-08-08 19:22:54 +02:00
commit b58c200b21
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
83 changed files with 3617 additions and 3286 deletions

4
.gitmodules vendored Normal file
View File

@ -0,0 +1,4 @@
[submodule "docs/themes/docsy"]
path = docs/themes/docsy
url = https://github.com/google/docsy.git

10
docs/.gitignore vendored
View File

@ -1,3 +1,7 @@
_site
.sass-cache
.jekyll-metadata
public/
resources/
node_modules/
tech-doc-hugo
.vscode/

View File

@ -1,32 +0,0 @@
---
layout: default
title: Page not found
permalink: /404
nav_exclude: true
search_exclude: true
sitemap: false
exclude: true
---
<h1>Page not found</h1>
<p>The page you requested could not be found. Try using the navigation {% if site.search_enabled %}or search {% endif %}to find what you're looking for or go to this <a href="{{ site.url }}{{ site.baseurl }}">site's home page</a>.</p>
<h2>Check out these features</h2>
{% assign posts = site.pages | sort:"nav_order" %}
<ul>
{% for post in posts %}
{% if post.layout == "feature" %}
<li><a href="{{post.url | absolute_url}}">{{post.title}}</a></li>
{% endif %}
{% endfor %}
</ul>
<h2>Or these in-depth guides</h2>
<ul>
{% for post in posts %}
{% if post.layout == "guide" %}
<li><a href="{{post.url | absolute_url}}">{{post.title}}</a></li>
{% endif %}
{% endfor %}
</ul>

View File

@ -1 +0,0 @@
moor.simonbinder.eu

View File

@ -1,24 +0,0 @@
source "https://rubygems.org"
# Hello! This is where you manage which Jekyll version is used to run.
# When you want to use a different version, change it below, save the
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
#
# bundle exec jekyll serve
#
# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
gem "just-the-docs"
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
gem "github-pages", group: :jekyll_plugins
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.0" if Gem.win_platform?
gem 'jekyll-sitemap'

View File

@ -1,256 +0,0 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (4.2.11.1)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.11.1)
colorator (1.1.0)
commonmarker (0.17.13)
ruby-enum (~> 0.5)
concurrent-ruby (1.1.5)
dnsruby (1.61.2)
addressable (~> 2.5)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
ethon (0.12.0)
ffi (>= 1.3.0)
eventmachine (1.2.7)
execjs (2.7.0)
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
ffi (1.11.1)
forwardable-extended (2.6.0)
gemoji (3.0.1)
github-pages (198)
activesupport (= 4.2.11.1)
github-pages-health-check (= 1.16.1)
jekyll (= 3.8.5)
jekyll-avatar (= 0.6.0)
jekyll-coffeescript (= 1.1.1)
jekyll-commonmark-ghpages (= 0.1.5)
jekyll-default-layout (= 0.1.4)
jekyll-feed (= 0.11.0)
jekyll-gist (= 1.5.0)
jekyll-github-metadata (= 2.12.1)
jekyll-mentions (= 1.4.1)
jekyll-optional-front-matter (= 0.3.0)
jekyll-paginate (= 1.1.0)
jekyll-readme-index (= 0.2.0)
jekyll-redirect-from (= 0.14.0)
jekyll-relative-links (= 0.6.0)
jekyll-remote-theme (= 0.3.1)
jekyll-sass-converter (= 1.5.2)
jekyll-seo-tag (= 2.5.0)
jekyll-sitemap (= 1.2.0)
jekyll-swiss (= 0.4.0)
jekyll-theme-architect (= 0.1.1)
jekyll-theme-cayman (= 0.1.1)
jekyll-theme-dinky (= 0.1.1)
jekyll-theme-hacker (= 0.1.1)
jekyll-theme-leap-day (= 0.1.1)
jekyll-theme-merlot (= 0.1.1)
jekyll-theme-midnight (= 0.1.1)
jekyll-theme-minimal (= 0.1.1)
jekyll-theme-modernist (= 0.1.1)
jekyll-theme-primer (= 0.5.3)
jekyll-theme-slate (= 0.1.1)
jekyll-theme-tactile (= 0.1.1)
jekyll-theme-time-machine (= 0.1.1)
jekyll-titles-from-headings (= 0.5.1)
jemoji (= 0.10.2)
kramdown (= 1.17.0)
liquid (= 4.0.0)
listen (= 3.1.5)
mercenary (~> 0.3)
minima (= 2.5.0)
nokogiri (>= 1.8.5, < 2.0)
rouge (= 2.2.1)
terminal-table (~> 1.4)
github-pages-health-check (1.16.1)
addressable (~> 2.3)
dnsruby (~> 1.60)
octokit (~> 4.0)
public_suffix (~> 3.0)
typhoeus (~> 1.3)
html-pipeline (2.11.0)
activesupport (>= 2)
nokogiri (>= 1.4)
http_parser.rb (0.6.0)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
jekyll (3.8.5)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (~> 0.7)
jekyll-sass-converter (~> 1.0)
jekyll-watch (~> 2.0)
kramdown (~> 1.14)
liquid (~> 4.0)
mercenary (~> 0.3.3)
pathutil (~> 0.9)
rouge (>= 1.7, < 4)
safe_yaml (~> 1.0)
jekyll-avatar (0.6.0)
jekyll (~> 3.0)
jekyll-coffeescript (1.1.1)
coffee-script (~> 2.2)
coffee-script-source (~> 1.11.1)
jekyll-commonmark (1.3.1)
commonmarker (~> 0.14)
jekyll (>= 3.7, < 5.0)
jekyll-commonmark-ghpages (0.1.5)
commonmarker (~> 0.17.6)
jekyll-commonmark (~> 1)
rouge (~> 2)
jekyll-default-layout (0.1.4)
jekyll (~> 3.0)
jekyll-feed (0.11.0)
jekyll (~> 3.3)
jekyll-gist (1.5.0)
octokit (~> 4.2)
jekyll-github-metadata (2.12.1)
jekyll (~> 3.4)
octokit (~> 4.0, != 4.4.0)
jekyll-mentions (1.4.1)
html-pipeline (~> 2.3)
jekyll (~> 3.0)
jekyll-optional-front-matter (0.3.0)
jekyll (~> 3.0)
jekyll-paginate (1.1.0)
jekyll-readme-index (0.2.0)
jekyll (~> 3.0)
jekyll-redirect-from (0.14.0)
jekyll (~> 3.3)
jekyll-relative-links (0.6.0)
jekyll (~> 3.3)
jekyll-remote-theme (0.3.1)
jekyll (~> 3.5)
rubyzip (>= 1.2.1, < 3.0)
jekyll-sass-converter (1.5.2)
sass (~> 3.4)
jekyll-seo-tag (2.5.0)
jekyll (~> 3.3)
jekyll-sitemap (1.2.0)
jekyll (~> 3.3)
jekyll-swiss (0.4.0)
jekyll-theme-architect (0.1.1)
jekyll (~> 3.5)
jekyll-seo-tag (~> 2.0)
jekyll-theme-cayman (0.1.1)
jekyll (~> 3.5)
jekyll-seo-tag (~> 2.0)
jekyll-theme-dinky (0.1.1)
jekyll (~> 3.5)
jekyll-seo-tag (~> 2.0)
jekyll-theme-hacker (0.1.1)
jekyll (~> 3.5)
jekyll-seo-tag (~> 2.0)
jekyll-theme-leap-day (0.1.1)
jekyll (~> 3.5)
jekyll-seo-tag (~> 2.0)
jekyll-theme-merlot (0.1.1)
jekyll (~> 3.5)
jekyll-seo-tag (~> 2.0)
jekyll-theme-midnight (0.1.1)
jekyll (~> 3.5)
jekyll-seo-tag (~> 2.0)
jekyll-theme-minimal (0.1.1)
jekyll (~> 3.5)
jekyll-seo-tag (~> 2.0)
jekyll-theme-modernist (0.1.1)
jekyll (~> 3.5)
jekyll-seo-tag (~> 2.0)
jekyll-theme-primer (0.5.3)
jekyll (~> 3.5)
jekyll-github-metadata (~> 2.9)
jekyll-seo-tag (~> 2.0)
jekyll-theme-slate (0.1.1)
jekyll (~> 3.5)
jekyll-seo-tag (~> 2.0)
jekyll-theme-tactile (0.1.1)
jekyll (~> 3.5)
jekyll-seo-tag (~> 2.0)
jekyll-theme-time-machine (0.1.1)
jekyll (~> 3.5)
jekyll-seo-tag (~> 2.0)
jekyll-titles-from-headings (0.5.1)
jekyll (~> 3.3)
jekyll-watch (2.2.1)
listen (~> 3.0)
jemoji (0.10.2)
gemoji (~> 3.0)
html-pipeline (~> 2.2)
jekyll (~> 3.0)
just-the-docs (0.2.5)
jekyll (~> 3.8.5)
jekyll-seo-tag (~> 2.0)
rake (~> 12.3.1)
kramdown (1.17.0)
liquid (4.0.0)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
mercenary (0.3.6)
mini_portile2 (2.4.0)
minima (2.5.0)
jekyll (~> 3.5)
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)
minitest (5.11.3)
multipart-post (2.1.1)
nokogiri (1.10.3)
mini_portile2 (~> 2.4.0)
octokit (4.14.0)
sawyer (~> 0.8.0, >= 0.5.3)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (3.1.1)
rake (12.3.2)
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
ffi (~> 1.0)
rouge (2.2.1)
ruby-enum (0.7.2)
i18n
ruby_dep (1.5.0)
rubyzip (1.2.3)
safe_yaml (1.0.5)
sass (3.7.4)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sawyer (0.8.2)
addressable (>= 2.3.5)
faraday (> 0.8, < 2.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
thread_safe (0.3.6)
typhoeus (1.3.1)
ethon (>= 0.9.0)
tzinfo (1.2.5)
thread_safe (~> 0.1)
unicode-display_width (1.6.0)
PLATFORMS
ruby
DEPENDENCIES
github-pages
jekyll-sitemap
just-the-docs
tzinfo-data
BUNDLED WITH
2.0.1

12
docs/README.md Normal file
View File

@ -0,0 +1,12 @@
# Moor documentation
Contains the source code for the moor documentation, live at moor.simonbinder.eu
We use [Docsy](https://github.com/google/docsy), a Hugo theme for this website. You'll need the extended version of Hugo as described
[here](https://www.docsy.dev/docs/getting-started/).
To work on the documentation, first cd into this directory, then run `git submodule update --init --recursive` an `npm install`.
## Running the website locally
After the setup, it's just a simple
```
hugo server
```

View File

@ -1,47 +0,0 @@
# Welcome to Jekyll!
#
# This config file is meant for settings that affect your whole blog, values
# which you are expected to set up once and rarely edit after that. If you find
# yourself editing this file very often, consider using Jekyll's data files
# feature for the data you need to update frequently.
#
# For technical reasons, this file is *NOT* reloaded automatically when you use
# 'bundle exec jekyll serve'. If you change this file, please restart the server process.
# Site settings
# These are used to personalize your new site. If you look in the HTML files,
# you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
# You can create any custom variable you would like, and they will be accessible
# in the templates via {{ site.myvariable }}.
title: Moor
#email: your-email@example.com
description: >- # this means to ignore newlines until "baseurl:"
Moor is an easy to use, reactive, typesafe persistence library for Flutter apps.
baseurl: "/" # the subpath of your site, e.g. /blog
url: "https://moor.simonbinder.eu" # the base hostname & protocol for your site, e.g. http://example.com
#twitter_username: jekyllrb
github_link: https://github.com/simolus3/moor
search_enabled: true
common_links:
getting_started: "/getting-started"
# Build settings
markdown: kramdown
theme: just-the-docs
plugins:
- jekyll-feed
- jekyll-sitemap
# Exclude from processing.
# The following items will not be processed, by default. Create a custom list
# to override the default setting.
# exclude:
# - Gemfile
# - Gemfile.lock
# - node_modules
# - vendor/bundle/
# - vendor/cache/
# - vendor/gems/
# - vendor/ruby/

View File

@ -1,22 +0,0 @@
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
{% if page.meta_title != nil %}
<title>{{ page.meta_title }}</title>
{% else %}
<title>{{ page.title }} - {{ site.title }}</title>
{% endif %}
{% if page.description %}
<meta name="Description" content="{{ page.description }}">
{% endif %}
<link rel="stylesheet" href="{{ "/assets/css/just-the-docs.css" | absolute_url }}">
{% if site.search_enabled != nil %}
<script type="text/javascript" src="{{ "/assets/js/vendor/lunr.min.js" | absolute_url }}"></script>
{% endif %}
<script type="text/javascript" src="{{ "/assets/js/just-the-docs.js" | absolute_url }}"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>

View File

@ -1,44 +0,0 @@
<nav role="navigation" aria-label="Main navigation">
<ul class="navigation-list">
{% assign pages_list = site.html_pages | sort:"nav_order" %}
{% for node in pages_list %}
{% unless node.nav_exclude %}
{% if node.parent == nil %}
<li class="navigation-list-item{% if page.url == node.url or page.parent == node.title or page.grand_parent == node.title %} active{% endif %}">
{% if page.parent == node.title or page.grand_parent == node.title %}
{% assign first_level_url = node.url | absolute_url %}
{% endif %}
<a href="{{ node.url | absolute_url }}" class="navigation-list-link{% if page.url == node.url %} active{% endif %}">{{ node.title }}</a>
{% if node.has_children %}
{% assign children_list = site.html_pages | sort:"nav_order" %}
<ul class="navigation-list-child-list ">
{% for child in children_list %}
{% if child.parent == node.title %}
<li class="navigation-list-item {% if page.url == child.url or page.parent == child.title %} active{% endif %}">
{% if page.url == child.url or page.parent == child.title %}
{% assign second_level_url = child.url | absolute_url %}
{% endif %}
<a href="{{ child.url | absolute_url }}" class="navigation-list-link{% if page.url == child.url %} active{% endif %}">{{ child.title }}</a>
{% if child.has_children %}
{% assign grand_children_list = site.html_pages | sort:"nav_order" %}
<ul class="navigation-list-child-list">
{% for grand_child in grand_children_list %}
{% if grand_child.parent == child.title %}
<li class="navigation-list-item {% if page.url == grand_child.url %} active{% endif %}">
<a href="{{ grand_child.url | absolute_url }}" class="navigation-list-link{% if page.url == grand_child.url %} active{% endif %}">{{ grand_child.title }}</a>
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
</li>
{% endif %}
{% endunless %}
{% endfor %}
</ul>
</nav>

View File

@ -1,85 +0,0 @@
<!DOCTYPE html>
<html lang="en-us">
{% include head.html %}
<body>
<div class="page-wrap">
<div class="side-bar">
<a href="{{ site.url }}{{ site.baseurl }}" class="site-title fs-6 lh-tight">{{ site.title }}</a>
<span class="fs-3"><button class="js-main-nav-trigger navigation-list-toggle btn btn-outline" type="button" data-text-toggle="Hide">Menu</button></span>
<div class="navigation main-nav js-main-nav">
{% include nav.html %}
</div>
<footer role="contentinfo" class="site-footer">
<p class="text-small text-grey-dk-000 mb-0">This site uses <a href="https://github.com/pmarsceill/just-the-docs">Just the Docs</a>, a documentation theme for Jekyll.</p>
</footer>
</div>
<div class="main-content-wrap js-main-content" tabindex="0">
<div class="page-header">
<div class="main-content">
{% if site.search_enabled != nil %}
<div class="search js-search">
<div class="search-input-wrap">
<input type="text" class="js-search-input search-input" tabindex="0" placeholder="Search {{ site.title }}" aria-label="Search {{ site.title }}" autocomplete="off">
<svg width="14" height="14" viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg" class="search-icon"><title>Search</title><g fill-rule="nonzero"><path d="M17.332 20.735c-5.537 0-10-4.6-10-10.247 0-5.646 4.463-10.247 10-10.247 5.536 0 10 4.601 10 10.247s-4.464 10.247-10 10.247zm0-4c3.3 0 6-2.783 6-6.247 0-3.463-2.7-6.247-6-6.247s-6 2.784-6 6.247c0 3.464 2.7 6.247 6 6.247z"/><path d="M11.672 13.791L.192 25.271 3.02 28.1 14.5 16.62z"/></g></svg>
</div>
<div class="js-search-results search-results-wrap"></div>
</div>
{% endif %}
{% comment %} Changes from upstream here to include pub badge {% endcomment %}
<ul class="list-style-none text-small mt-md-1 mb-md-1 pb-4 pb-md-0 js-aux-nav aux-nav">
<li><a href="https://pub.dartlang.org/packages/moor_flutter"><img src="https://img.shields.io/pub/v/moor_flutter.svg" alt="Pub version badge" /></a></li>
<li><a href="{{site.github_link}}"><img src="https://img.shields.io/badge/repo-24292E.svg?logo=github&style=flat" alt="GitHub repository"></a></li>
</ul>
</div>
</div>
<div class="main-content">
{% unless page.url == "/" %}
{% if page.parent %}
<nav class="breadcrumb-nav">
<ol class="breadcrumb-nav-list">
{% if page.grand_parent %}
<li class="breadcrumb-nav-list-item"><a href="{{ first_level_url }}">{{ page.grand_parent }}</a></li>
<li class="breadcrumb-nav-list-item"><a href="{{ second_level_url }}">{{ page.parent }}</a></li>
{% else %}
<li class="breadcrumb-nav-list-item"><a href="{{ first_level_url }}">{{ page.parent }}</a></li>
{% endif %}
<li class="breadcrumb-nav-list-item"><span>{{ page.title }}</span></li>
</ol>
</nav>
{% endif %}
{% endunless %}
<div id="main-content" class="page-content" role="main">
{{ content }}
{% if page.has_children == true and page.has_toc != false %}
<hr>
<h2 class="text-delta">Table of contents</h2>
{% assign children_list = site.pages | sort:"nav_order" %}
<ul>
{% for child in children_list %}
{% if child.parent == page.title and child.title != page.title %}
<li>
<a href="{{ child.url | absolute_url }}">{{ child.title }}</a>
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
<hr>
<span class="fs-2">
Was this page helpful? Please
{% assign url = page.url | absolute_url %}
{% assign body = 'Refers to the documentation: ' | append: url %}
<a href="{{site.github_link}}/issues/new?body={{body | url_encode}}">report an issue</a>
if you have questions or run into problems.
</span>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -1,8 +0,0 @@
---
layout: default
---
{% if page.since != nil %}
<span class="label label-green">Available from {{page.since}}</span>
{% endif %}
{{ content }}

View File

@ -1,5 +0,0 @@
---
layout: default
---
{{ content }}

View File

@ -1,110 +0,0 @@
//
// Base element style overrides
//
// stylelint-disable selector-no-type, selector-max-type
* {
box-sizing: border-box;
}
::selection {
color: $white;
background: $link-color;
}
html {
@include fs-4;
}
body {
font-family: $body-font-family;
font-size: inherit;
line-height: $body-line-height;
color: $body-text-color;
background-color: $body-background-color;
}
p,
h1,
h2,
h3,
h4,
h5,
h6,
ol,
ul,
pre,
address,
blockquote,
dl,
div,
fieldset,
form,
hr,
noscript,
table {
margin-top: 0;
}
h1,
h2,
h3,
h4,
h5,
h6 {
margin-top: 1.2em;
margin-bottom: 0.8em;
font-weight: 500;
line-height: $body-heading-line-height;
color: $body-heading-color;
}
p {
margin-bottom: 1em;
}
a {
color: $link-color;
text-decoration: none;
}
a:not([class]) {
text-decoration: none;
background-image: linear-gradient($border-color 0%, $border-color 100%);
background-repeat: repeat-x;
background-position: 0 100%;
background-size: 1px 1px;
&:hover {
background-image: linear-gradient(rgba($link-color, 0.45) 0%, rgba($link-color, 0.45) 100%);
background-size: 1px 1px;
}
}
code {
font-family: $mono-font-family;
font-size: 12px;
line-height: $body-line-height;
}
figure {
margin: 0;
}
li {
margin: 0.25em 0;
}
img {
max-width: 100%;
height: auto;
}
hr {
height: 1px;
padding: 0;
margin: $sp-6 0;
background-color: $border-color;
border: 0;
}

View File

@ -1,118 +0,0 @@
//
// Buttons and things that look like buttons
//
// stylelint-disable color-named
.btn {
display: inline-block;
box-sizing: border-box;
padding-top: 0.3em;
padding-right: 1em;
padding-bottom: 0.3em;
padding-left: 1em;
margin: 0;
font-family: inherit;
font-size: inherit;
font-weight: 500;
line-height: 1.5;
color: $link-color;
text-decoration: none;
vertical-align: baseline;
cursor: pointer;
background-color: $base-button-color;
border-width: 0;
border-radius: 3px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 3px 10px rgba(0, 0, 0, 0.08);
appearance: none;
&:focus {
text-decoration: none;
outline: none;
box-shadow: 0 0 0 3px rgba(blue, 0.25);
}
&:focus:hover,
&.selected:focus {
box-shadow: 0 0 0 3px rgba(blue, 0.25);
}
&:hover,
&.zeroclipboard-is-hover {
color: darken($link-color, 2%);
}
&:hover,
&:active,
&.zeroclipboard-is-hover,
&.zeroclipboard-is-active {
text-decoration: none;
background-color: darken($base-button-color, 1%);
}
&:active,
&.selected,
&.zeroclipboard-is-active {
background-color: darken($base-button-color, 3%);
background-image: none;
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
}
&.selected:hover {
background-color: darken(#dcdcdc, 5%);
}
&:disabled,
&.disabled {
&,
&:hover {
color: rgba(102, 102, 102, 0.5);
cursor: default;
background-color: rgba(229, 229, 229, 0.5);
background-image: none;
box-shadow: none;
}
}
}
.btn-outline {
color: $link-color;
background: transparent;
box-shadow: inset 0 0 0 2px $grey-lt-300;
&:hover,
&:active,
&.zeroclipboard-is-hover,
&.zeroclipboard-is-active {
color: darken($link-color, 4%);
text-decoration: none;
background-color: transparent;
box-shadow: inset 0 0 0 3px $grey-lt-300;
}
&:focus {
text-decoration: none;
outline: none;
box-shadow: inset 0 0 0 2px $grey-dk-100, 0 0 0 3px rgba(blue, 0.25);
}
&:focus:hover,
&.selected:focus {
box-shadow: inset 0 0 0 2px $grey-dk-100;
}
}
.btn-primary {
@include btn-color($white, $btn-primary-color);
}
.btn-purple {
@include btn-color($white, $purple-100);
}
.btn-blue {
@include btn-color($white, $blue-000);
}
.btn-green {
@include btn-color($white, $green-100);
}

View File

@ -1,114 +0,0 @@
//
// Code and syntax highlighting
//
// stylelint-disable selector-no-qualifying-type, declaration-block-semicolon-newline-after,declaration-block-single-line-max-declarations, selector-no-type, selector-max-type
code {
padding: 0.2em 0.15em;
font-weight: 400;
background-color: $code-background-color;
border: $border $border-color;
border-radius: $border-radius;
}
pre.highlight {
padding: $sp-3;
margin-bottom: 0;
-webkit-overflow-scrolling: touch;
background-color: $code-background-color;
code {
padding: 0;
border: 0;
}
}
.highlighter-rouge {
margin-bottom: $sp-3;
overflow: hidden;
border-radius: $border-radius;
}
.highlight .c { color: #999988; font-style: italic } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #000000; font-weight: bold } /* Keyword */
.highlight .o { color: #000000; font-weight: bold } /* Operator */
.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #999999; font-weight: bold; font-style: italic } /* Comment.Preproc */
.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { color: #000000; font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #999999 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #aaaaaa } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #000000; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #000000; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #000000; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #000000; font-weight: bold } /* Keyword.Pseudo */
.highlight .kr { color: #000000; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #009999 } /* Literal.Number */
.highlight .s { color: #d01040 } /* Literal.String */
.highlight .na { color: #008080 } /* Name.Attribute */
.highlight .nb { color: #0086B3 } /* Name.Builtin */
.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */
.highlight .no { color: #008080 } /* Name.Constant */
.highlight .nd { color: #3c5d5d; font-weight: bold } /* Name.Decorator */
.highlight .ni { color: #800080 } /* Name.Entity */
.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */
.highlight .nl { color: #990000; font-weight: bold } /* Name.Label */
.highlight .nn { color: #555555 } /* Name.Namespace */
.highlight .nt { color: #000080 } /* Name.Tag */
.highlight .nv { color: #008080 } /* Name.Variable */
.highlight .ow { color: #000000; font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mf { color: #009999 } /* Literal.Number.Float */
.highlight .mh { color: #009999 } /* Literal.Number.Hex */
.highlight .mi { color: #009999 } /* Literal.Number.Integer */
.highlight .mo { color: #009999 } /* Literal.Number.Oct */
.highlight .sb { color: #d01040 } /* Literal.String.Backtick */
.highlight .sc { color: #d01040 } /* Literal.String.Char */
.highlight .sd { color: #d01040 } /* Literal.String.Doc */
.highlight .s2 { color: #d01040 } /* Literal.String.Double */
.highlight .se { color: #d01040 } /* Literal.String.Escape */
.highlight .sh { color: #d01040 } /* Literal.String.Heredoc */
.highlight .si { color: #d01040 } /* Literal.String.Interpol */
.highlight .sx { color: #d01040 } /* Literal.String.Other */
.highlight .sr { color: #009926 } /* Literal.String.Regex */
.highlight .s1 { color: #d01040 } /* Literal.String.Single */
.highlight .ss { color: #990073 } /* Literal.String.Symbol */
.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */
.highlight .vc { color: #008080 } /* Name.Variable.Class */
.highlight .vg { color: #008080 } /* Name.Variable.Global */
.highlight .vi { color: #008080 } /* Name.Variable.Instance */
.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */
//
// Code examples (rendered)
//
.code-example {
padding: $sp-3;
margin-bottom: $sp-3;
overflow: auto;
border: 1px solid $border-color;
border-radius: $border-radius;
+ .highlighter-rouge,
+ figure.highlight {
position: relative;
margin-top: -$sp-4;
border-right: 1px solid $border-color;
border-bottom: 1px solid $border-color;
border-left: 1px solid $border-color;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
}

View File

@ -1,14 +0,0 @@
$body-background-color: $grey-dk-300;
$sidebar-color: $grey-dk-300;
$border-color: $grey-dk-200;
$body-text-color: $grey-lt-300;
$body-heading-color: $grey-lt-000;
$nav-child-link-color: $grey-dk-000;
$link-color: $blue-000;
$btn-primary-color: $blue-200;
$base-button-color: $grey-dk-250;
$code-background-color: $grey-dk-250;

View File

@ -1,114 +0,0 @@
@charset "UTF-8";
//
// Styles for rendered markdown in the .main-content container
//
// stylelint-disable selector-no-type, max-nesting-depth, selector-max-compound-selectors, selector-max-type
.page-content {
a {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
ul,
ol {
padding-left: 1.5em;
}
ol {
list-style-type: none;
counter-reset: step-counter;
> li {
position: relative;
&::before {
position: absolute;
top: 0.2em;
left: -1.6em;
color: $grey-dk-000;
content: counter(step-counter);
counter-increment: step-counter;
@include fs-3;
@include mq(sm) {
top: 0.11em;
}
}
ol {
counter-reset: sub-counter;
li {
&::before {
content: counter(sub-counter, lower-alpha);
counter-increment: sub-counter;
}
}
}
}
}
ul {
list-style: none;
> li {
&::before {
position: absolute;
margin-left: -1.4em;
color: $grey-dk-000;
content: "";
}
}
}
.task-list {
padding-left: 0;
}
.task-list-item {
display: flex;
align-items: center;
&::before {
content: "";
}
}
.task-list-item-checkbox {
margin-right: 0.6em;
}
hr + * {
margin-top: 0;
}
h1:first-of-type {
margin-top: 0.5em;
}
dl {
display: grid;
grid-template-columns: max-content 1fr;
}
dt,
dd {
margin: 0.25em 0;
}
dt {
text-align: right;
&::after {
content: ":";
}
}
dd {
margin-left: 1em;
font-weight: 500;
}
}

View File

@ -1,120 +0,0 @@
// //
// // Typography
// //
//
// $body-font-family: -apple-system, BlinkMacSystemFont, "helvetica neue", helvetica, roboto, noto, "segoe ui", arial, sans-serif;
// $mono-font-family: "SFMono-Regular", Menlo, Consolas, Monospace;
// $root-font-size: 16px; // Base font-size for rems
// $body-line-height: 1.4;
// $body-heading-line-height: 1.15;
//
// //
// // Colors
// //
//
// $white: #fff;
//
// $grey-dk-000: #959396;
// $grey-dk-100: #5c5962;
// $grey-dk-200: #44434d;
// $grey-dk-250: #302d36 !default;
// $grey-dk-300: #27262b;
//
// $grey-lt-000: #f5f6fa;
// $grey-lt-100: #eeebee;
// $grey-lt-200: #ecebed;
// $grey-lt-300: #e6e1e8;
//
// $purple-000: #7253ed;
// $purple-100: #5e41d0;
// $purple-200: #4e26af;
// $purple-300: #381885;
//
// $blue-000: #2c84fa;
// $blue-100: #2869e6;
// $blue-200: #264caf;
// $blue-300: #183385;
//
// $green-000: #41d693;
// $green-100: #11b584;
// $green-200: #009c7b;
// $green-300: #026e57;
//
// $body-background-color: $white !default;
// $sidebar-color: $grey-lt-000 !default;
// $code-background-color: $grey-lt-000 !default;
// $body-text-color: $grey-dk-100 !default;
// $body-heading-color: $grey-dk-300 !default;
// $nav-child-link-color: $grey-dk-100 !default;
// $link-color: $purple-000 !default;
// $btn-primary-color: $purple-100 !default;
// $base-button-color: #f7f7f7 !default;
//
// //
// // Media queries in pixels
// //
//
// $media-queries: (
// xs: 320px,
// sm: 500px,
// md: 740px,
// lg: 1120px,
// xl: 1400px
// );
//
// //
// // Spacing
// //
//
// $spacing-unit: 1rem; // 1rem == 16px
//
// $spacers: (
// sp-0: 0,
// sp-1: $spacing-unit * 0.25,
// sp-2: $spacing-unit * 0.5,
// sp-3: $spacing-unit * 0.75,
// sp-4: $spacing-unit,
// sp-5: $spacing-unit * 1.5,
// sp-6: $spacing-unit * 2,
// sp-7: $spacing-unit * 2.5,
// sp-8: $spacing-unit * 3,
// sp-9: $spacing-unit * 3.5,
// sp-10: $spacing-unit * 4
// );
//
// $sp-1: map-get($spacers, sp-1); // 0.25 rem == 4px
// $sp-2: map-get($spacers, sp-2); // 0.5 rem == 8px
// $sp-3: map-get($spacers, sp-3); // 0.75 rem == 12px
// $sp-4: map-get($spacers, sp-4); // 1 rem == 16px
// $sp-5: map-get($spacers, sp-5); // 1.5 rem == 24px
// $sp-6: map-get($spacers, sp-6); // 2 rem == 32px
// $sp-7: map-get($spacers, sp-7); // 2.5 rem == 40px
// $sp-8: map-get($spacers, sp-8); // 3 rem == 48px
// $sp-9: map-get($spacers, sp-9); // 4 rem == 48px
// $sp-10: map-get($spacers, sp-10); // 4.5 rem == 48px
//
// //
// // Borders
// //
//
// $border: 1px solid;
// $border-radius: 4px;
// $border-color: $grey-lt-100;
//
// //
// // Grid system
// //
//
// $gutter-spacing: $sp-6;
// $gutter-spacing-sm: $sp-4;
// $nav-width: 232px;
// $content-width: 800px;
//
// $media-queries: (
// xs: 320px,
// sm: 500px,
// md: 740px,
// lg: 800px,
// xl: 1316px
// );

View File

@ -1,36 +0,0 @@
//
// Labels (not the form kind)
//
.label,
.label-blue {
display: inline-block;
padding-top: 0.16em;
padding-right: 0.42em;
padding-bottom: 0.16em;
padding-left: 0.42em;
margin-right: $sp-1;
margin-left: $sp-1;
color: $white;
text-transform: uppercase;
vertical-align: middle;
background-color: $blue-100;
@include fs-2;
}
.label-green {
background-color: $green-200;
}
.label-purple {
background-color: $purple-100;
}
.label-red {
background-color: $red-200;
}
.label-yellow {
color: $grey-dk-200;
background-color: $yellow-200;
}

View File

@ -1,147 +0,0 @@
//
// The basic two column layout
//
.page-wrap {
@include mq(md) {
position: absolute;
top: 0;
left: 0;
display: flex;
width: 100%;
height: 100%;
overflow-x: hidden;
overflow-y: hidden;
}
}
.side-bar {
z-index: 100;
display: flex;
flex-wrap: wrap;
padding-top: $gutter-spacing-sm;
padding-bottom: $gutter-spacing-sm;
background-color: $sidebar-color;
@include mq(md) {
flex-wrap: nowrap;
position: absolute;
width: $nav-width + 16px;
height: 100%;
padding-top: $gutter-spacing * 2;
padding-bottom: 0;
flex-direction: column;
border-right: $border $border-color;
align-items: flex-end;
}
@include mq(lg) {
width: calc((100% - #{$nav-width + $content-width}) / 2 + #{$nav-width});
min-width: $nav-width;
}
}
.main-content-wrap {
@include mq(md) {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
min-height: 600px;
-webkit-overflow-scrolling: touch;
overflow-x: hidden;
overflow-y: scroll;
}
}
.main-content {
padding-top: $gutter-spacing-sm;
@include container;
@include mq(md) {
position: relative;
max-width: $content-width;
padding-top: $gutter-spacing;
padding-bottom: $gutter-spacing;
padding-left: $gutter-spacing * 1.5;
margin-left: $nav-width;
}
@include mq(lg) {
padding-left: $gutter-spacing;
margin-left: calc((100% - #{$nav-width + $content-width}) / 2 + #{$nav-width});
}
}
.js-main-content:focus {
outline: none;
}
.page-header {
background-color: $sidebar-color;
@include mq(md) {
background-color: $body-background-color;
}
.main-content {
padding-top: 0;
@include mq(md) {
display: flex;
justify-content: flex-end;
height: 60px;
padding-top: $sp-4;
padding-bottom: $sp-4;
border-bottom: $border $border-color;
}
}
}
.navigation,
.site-title,
.site-footer {
@include container;
width: 100%;
@include mq(lg) {
width: $nav-width + 32px;
}
}
.navigation {
@include mq(md) {
padding-top: $sp-8;
overflow-y: auto;
flex: 1 1 auto;
}
}
// stylelint-disable selector-no-type
body {
position: relative;
padding-bottom: $sp-10;
@include mq(md) {
position: static;
padding-bottom: 0;
}
}
// stylelint-enable selector-no-type
.site-footer {
position: absolute;
bottom: 0;
padding-top: $sp-4;
padding-bottom: $sp-4;
@include mq(md) {
position: static;
align-self: flex-end;
justify-self: end;
background-color: $sidebar-color;
}
}

View File

@ -1,152 +0,0 @@
//
// Main nav, breadcrumb, etc...
//
.site-title {
display: block;
flex: 1 1 auto;
color: $body-heading-color;
background-color: $sidebar-color;
@include mq(md) {
position: absolute;
top: 0;
right: 0;
z-index: 101;
height: 60px;
padding-top: $sp-4;
border-bottom: $border $border-color;
}
}
.navigation-list {
padding: 0;
margin-top: $sp-4;
margin-bottom: 0;
list-style: none;
@include mq(md) {
margin-top: 0;
}
}
.navigation-list-child-list {
padding-left: $sp-3;
list-style: none;
.navigation-list-link {
color: $nav-child-link-color;
}
.navigation-list-item {
position: relative;
&::before {
position: absolute;
margin-top: 0.3em;
margin-left: -0.8em;
color: rgba($body-text-color, 0.3);
content: "- ";
}
&.active {
&::before {
color: $body-text-color;
}
}
}
}
.navigation-list-item {
@include fs-4;
margin: 0;
@include mq(md) {
@include fs-3;
}
.navigation-list-child-list {
display: none;
}
&.active {
.navigation-list-child-list {
display: block;
}
}
}
.navigation-list-link {
display: block;
padding-top: $sp-1;
padding-bottom: $sp-1;
&.active {
font-weight: 600;
color: $body-heading-color;
text-decoration: none;
}
}
// Small screen nav
.main-nav,
.aux-nav {
display: none;
&.nav-open {
display: block;
}
@include mq(md) {
display: block;
}
}
.aux-nav li {
display: inline-block;
}
.navigation-list-toggle {
position: absolute;
right: $sp-4;
@include mq(md) {
display: none !important;
}
}
// Breadcrumb nav
.breadcrumb-nav {
@include mq(md) {
margin-top: -$sp-4;
}
}
.breadcrumb-nav-list {
padding-left: 0;
margin-bottom: $sp-3;
list-style: none;
}
.breadcrumb-nav-list-item {
display: table-cell;
@include fs-2;
&::before {
display: none;
}
&::after {
display: inline-block;
margin-right: $sp-2;
margin-left: $sp-2;
color: $grey-dk-000;
content: "/";
}
&:last-child {
&::after {
content: "";
}
}
}

View File

@ -1,114 +0,0 @@
//
// Search input and autocomplete
//
.search {
position: relative;
z-index: 99;
display: none;
flex-grow: 1;
padding: $sp-2;
margin-bottom: $sp-3;
background-color: $white;
border-radius: 3px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07), 0 3px 10px rgba(0, 0, 0, 0.05);
@include mq(md) {
display: block;
padding-top: $sp-1;
padding-right: 0;
padding-bottom: 0;
padding-left: 0;
margin-bottom: 0;
background-color: transparent;
box-shadow: none;
}
&.nav-open {
display: block;
}
}
.search-results-wrap {
display: none;
&.active {
position: absolute;
top: $sp-1;
z-index: 100;
display: block;
width: 300px;
margin-top: $gutter-spacing;
background: lighten($body-background-color, 1%);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07), 0 4px 14px rgba(0, 0, 0, 0.05);
}
}
.search-input-wrap {
display: flex;
background-color: $body-background-color;
}
.search-input {
width: 100%;
padding-top: $sp-1;
padding-bottom: $sp-1;
background-color: $body-background-color;
border-top: 0;
border-right: 0;
border-bottom: 0;
border-left: 0;
order: 2;
&:focus {
outline: 0;
box-shadow: none;
+ .search-icon {
fill: $link-color;
}
}
@include fs-5;
@include mq(sm) {
@include fs-3;
}
@include mq(md) {
@include fs-2;
}
}
.search-icon {
align-self: center;
margin-right: $sp-2;
fill: $grey-dk-000;
order: 1;
}
.search-results-list {
padding-left: 0;
margin-top: $sp-1;
margin-bottom: $sp-1;
list-style: none;
@include fs-3;
}
.search-results-list-item {
padding: 0;
margin: 0;
}
.search-results-link {
display: block;
padding-top: $sp-1;
padding-right: $sp-3;
padding-bottom: $sp-1;
padding-left: $sp-3;
&:hover {
color: $body-heading-color;
background-color: darken($body-background-color, 2%);
}
}

View File

@ -1,10 +0,0 @@
@function rem($size, $unit:"") {
$remSize: $size / $root-font-size;
@if ($unit == false) {
@return #{$remSize};
}
@else {
@return #{$remSize}rem;
}
}

View File

@ -1,130 +0,0 @@
//
// Typography
//
$body-font-family: -apple-system, BlinkMacSystemFont, "helvetica neue", helvetica, roboto, noto, "segoe ui", arial, sans-serif !default;
$mono-font-family: "SFMono-Regular", Menlo, Consolas, Monospace !default;
$root-font-size: 16px !default; // Base font-size for rems
$body-line-height: 1.4 !default;
$body-heading-line-height: 1.15 !default !default;
//
// Colors
//
$white: #fff !default;
$grey-dk-000: #959396 !default;
$grey-dk-100: #5c5962 !default;
$grey-dk-200: #44434d !default;
$grey-dk-250: #302d36 !default;
$grey-dk-300: #27262b !default;
$grey-lt-000: #f5f6fa !default;
$grey-lt-100: #eeebee !default;
$grey-lt-200: #ecebed !default;
$grey-lt-300: #e6e1e8 !default;
$purple-000: #7253ed !default;
$purple-100: #5e41d0 !default;
$purple-200: #4e26af !default;
$purple-300: #381885 !default;
$blue-000: #2c84fa !default;
$blue-100: #2869e6 !default;
$blue-200: #264caf !default;
$blue-300: #183385 !default;
$green-000: #41d693 !default;
$green-100: #11b584 !default;
$green-200: #009c7b !default;
$green-300: #026e57 !default;
$yellow-000: #ffeb82 !default;
$yellow-100: #fadf50 !default;
$yellow-200: #f7d12e !default;
$yellow-300: #e7af06 !default;
$red-000: #f77e7e !default;
$red-100: #f96e65 !default;
$red-200: #e94c4c !default;
$red-300: #dd2e2e !default;
$body-background-color: $white !default;
$sidebar-color: $grey-lt-000 !default;
$code-background-color: $grey-lt-000 !default;
$body-text-color: $grey-dk-100 !default;
$body-heading-color: $grey-dk-300 !default;
$nav-child-link-color: $grey-dk-100 !default;
$link-color: $purple-000 !default;
$btn-primary-color: $purple-100 !default;
$base-button-color: #f7f7f7 !default;
//
// Media queries in pixels
//
$media-queries: (
xs: 320px,
sm: 500px,
md: 740px,
lg: 1120px,
xl: 1400px
) !default;
//
// Spacing
//
$spacing-unit: 1rem; // 1rem == 16px
$spacers: (
sp-0: 0,
sp-1: $spacing-unit * 0.25,
sp-2: $spacing-unit * 0.5,
sp-3: $spacing-unit * 0.75,
sp-4: $spacing-unit,
sp-5: $spacing-unit * 1.5,
sp-6: $spacing-unit * 2,
sp-7: $spacing-unit * 2.5,
sp-8: $spacing-unit * 3,
sp-9: $spacing-unit * 3.5,
sp-10: $spacing-unit * 4
) !default;
$sp-1: map-get($spacers, sp-1) !default; // 0.25 rem == 4px
$sp-2: map-get($spacers, sp-2) !default; // 0.5 rem == 8px
$sp-3: map-get($spacers, sp-3) !default; // 0.75 rem == 12px
$sp-4: map-get($spacers, sp-4) !default; // 1 rem == 16px
$sp-5: map-get($spacers, sp-5) !default; // 1.5 rem == 24px
$sp-6: map-get($spacers, sp-6) !default; // 2 rem == 32px
$sp-7: map-get($spacers, sp-7) !default; // 2.5 rem == 40px
$sp-8: map-get($spacers, sp-8) !default; // 3 rem == 48px
$sp-9: map-get($spacers, sp-9) !default; // 4 rem == 48px
$sp-10: map-get($spacers, sp-10) !default; // 4.5 rem == 48px
//
// Borders
//
$border: 1px solid !default;
$border-radius: 4px !default;
$border-color: $grey-lt-100 !default;
//
// Grid system
//
$gutter-spacing: $sp-6 !default;
$gutter-spacing-sm: $sp-4 !default;
$nav-width: 232px !default;
$content-width: 800px !default;
$media-queries: (
xs: 320px,
sm: 500px,
md: 740px,
lg: 800px,
xl: 1316px
) !default;

View File

@ -1,27 +0,0 @@
// Colored button
@mixin btn-color($fg, $bg) {
color: $fg;
background-color: darken($bg, 2%);
background-image: linear-gradient(lighten($bg, 5%), darken($bg, 2%));
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), 0 4px 10px rgba(0, 0, 0, 0.12);
&:hover,
&.zeroclipboard-is-hover {
color: $fg;
background-color: darken($bg, 4%);
background-image: linear-gradient((lighten($bg, 2%), darken($bg, 4%)));
}
&:active,
&.selected,
&.zeroclipboard-is-active {
background-color: darken($bg, 5%);
background-image: none;
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
}
&.selected:hover {
background-color: darken($bg, 10%);
}
}

View File

@ -1,36 +0,0 @@
// Media query
// Media query mixin
// Usage:
// @include mq(md) {
// ..medium and up styles
// }
@mixin mq($name) {
// Retrieves the value from the key
$value: map-get($media-queries, $name);
// If the key exists in the map
@if $value != null {
// Prints a media query based on the value
@media (min-width: rem($value)) {
@content;
}
}
@else {
@warn "No value could be retrieved from `#{$media-query}`. "
+ "Please make sure it is defined in `$media-queries` map.";
}
}
// Responsive container
@mixin container {
padding-right: $gutter-spacing-sm;
padding-left: $gutter-spacing-sm;
@include mq(md) {
padding-right: $gutter-spacing;
padding-left: $gutter-spacing;
}
}

View File

@ -1,81 +0,0 @@
// Font size
@mixin fs-1 {
font-size: 9px !important;
@include mq(sm) {
font-size: 10px !important;
}
}
@mixin fs-2 {
font-size: 11px !important;
@include mq(sm) {
font-size: 12px !important;
}
}
@mixin fs-3 {
font-size: 12px !important;
@include mq(sm) {
font-size: 14px !important;
}
}
@mixin fs-4 {
font-size: 14px !important;
@include mq(sm) {
font-size: 16px !important;
}
}
@mixin fs-5 {
font-size: 16px !important;
@include mq(sm) {
font-size: 18px !important;
}
}
@mixin fs-6 {
font-size: 18px !important;
@include mq(sm) {
font-size: 24px !important;
}
}
@mixin fs-7 {
font-size: 24px !important;
@include mq(sm) {
font-size: 32px !important;
}
}
@mixin fs-8 {
font-size: 32px !important;
@include mq(sm) {
font-size: 36px !important;
}
}
@mixin fs-9 {
font-size: 36px !important;
@include mq(sm) {
font-size: 42px !important;
}
}
@mixin fs-10 {
font-size: 42px !important;
@include mq(sm) {
font-size: 48px !important;
}
}

View File

@ -1,3 +0,0 @@
@import "./layout";
@import "./buttons";
@import "./typography";

View File

@ -1,3 +0,0 @@
@import "./variables";
@import "./functions";
@import "./mixins/mixins";

View File

@ -1,78 +0,0 @@
//
// Tables
//
// stylelint-disable max-nesting-depth, selector-no-type, selector-max-type
table {
display: block;
width: 100%;
max-width: 100%;
margin-bottom: $sp-5;
overflow-x: auto;
border-collapse: separate;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07), 0 4px 14px rgba(0, 0, 0, 0.05);
@include mq(sm) {
display: table;
}
}
th,
td {
@include fs-3;
min-width: 120px;
padding-top: $sp-2;
padding-right: $sp-3;
padding-bottom: $sp-2;
padding-left: $sp-3;
background-color: lighten($body-background-color, 2%);
border-bottom: $border rgba($border-color, 0.5);
border-left: $border $border-color;
&:first-of-type {
border-left: 0;
}
}
thead,
tbody:first-child {
tr {
&:first-of-type {
th,
td {
&:first-of-type {
border-top-left-radius: $border-radius;
}
&:last-of-type {
border-top-right-radius: $border-radius;
}
}
}
}
}
tbody {
tr {
&:last-of-type {
th,
td {
border-bottom: 0;
&:first-of-type {
border-bottom-left-radius: $border-radius;
}
&:last-of-type {
border-bottom-right-radius: $border-radius;
}
}
}
}
}
thead {
th {
border-bottom: 1px solid $border-color;
}
}

View File

@ -1,58 +0,0 @@
//
// Typography
//
// stylelint-disable primer/selector-no-utility, selector-no-type, selector-max-type
h1,
.text-alpha {
@include fs-8;
font-weight: 300;
}
h2,
.text-beta {
@include fs-6;
}
h3,
.text-gamma {
@include fs-5;
}
h4,
.text-delta {
@include fs-2;
font-weight: 300;
text-transform: uppercase;
letter-spacing: 0.1em;
}
h5,
.text-epsilon {
@include fs-3;
color: $grey-dk-200;
}
h6,
.text-zeta {
@include fs-2;
color: $grey-dk-200;
}
li {
.highlight {
margin-top: $sp-2;
}
}
.text-small {
@include fs-2;
}
.text-mono {
font-family: $mono-font-family !important;
}
.text-center {
text-align: center !important;
}

View File

@ -1,239 +0,0 @@
//
// Utility classes for colors
//
// Text colors
.text-grey-dk-000 {
color: $grey-dk-000 !important;
}
.text-grey-dk-100 {
color: $grey-dk-100 !important;
}
.text-grey-dk-200 {
color: $grey-dk-200 !important;
}
.text-grey-dk-250 {
color: $grey-dk-250 !important;
}
.text-grey-dk-300 {
color: $grey-dk-300 !important;
}
.text-grey-lt-000 {
color: $grey-lt-000 !important;
}
.text-grey-lt-100 {
color: $grey-lt-100 !important;
}
.text-grey-lt-200 {
color: $grey-lt-200 !important;
}
.text-grey-lt-300 {
color: $grey-lt-300 !important;
}
.text-blue-000 {
color: $blue-000 !important;
}
.text-blue-100 {
color: $blue-100 !important;
}
.text-blue-200 {
color: $blue-200 !important;
}
.text-blue-300 {
color: $blue-300 !important;
}
.text-green-000 {
color: $green-000 !important;
}
.text-green-100 {
color: $green-100 !important;
}
.text-green-200 {
color: $green-200 !important;
}
.text-green-300 {
color: $green-300 !important;
}
.text-purple-000 {
color: $purple-000 !important;
}
.text-purple-100 {
color: $purple-100 !important;
}
.text-purple-200 {
color: $purple-200 !important;
}
.text-purple-300 {
color: $purple-300 !important;
}
.text-yellow-000 {
color: $yellow-000 !important;
}
.text-yellow-100 {
color: $yellow-100 !important;
}
.text-yellow-200 {
color: $yellow-200 !important;
}
.text-yellow-300 {
color: $yellow-300 !important;
}
.text-red-000 {
color: $red-000 !important;
}
.text-red-100 {
color: $red-100 !important;
}
.text-red-200 {
color: $red-200 !important;
}
.text-red-300 {
color: $red-300 !important;
}
// Background colors
.bg-grey-dk-000 {
background-color: $grey-dk-000 !important;
}
.bg-grey-dk-100 {
background-color: $grey-dk-100 !important;
}
.bg-grey-dk-200 {
background-color: $grey-dk-200 !important;
}
.bg-grey-dk-250 {
background-color: $grey-dk-250 !important;
}
.bg-grey-dk-300 {
background-color: $grey-dk-300 !important;
}
.bg-grey-lt-000 {
background-color: $grey-lt-000 !important;
}
.bg-grey-lt-100 {
background-color: $grey-lt-100 !important;
}
.bg-grey-lt-200 {
background-color: $grey-lt-200 !important;
}
.bg-grey-lt-300 {
background-color: $grey-lt-300 !important;
}
.bg-blue-000 {
background-color: $blue-000 !important;
}
.bg-blue-100 {
background-color: $blue-100 !important;
}
.bg-blue-200 {
background-color: $blue-200 !important;
}
.bg-blue-300 {
background-color: $blue-300 !important;
}
.bg-green-000 {
background-color: $green-000 !important;
}
.bg-green-100 {
background-color: $green-100 !important;
}
.bg-green-200 {
background-color: $green-200 !important;
}
.bg-green-300 {
background-color: $green-300 !important;
}
.bg-purple-000 {
background-color: $purple-000 !important;
}
.bg-purple-100 {
background-color: $purple-100 !important;
}
.bg-purple-200 {
background-color: $purple-200 !important;
}
.bg-purple-300 {
background-color: $purple-300 !important;
}
.bg-yellow-000 {
background-color: $yellow-000 !important;
}
.bg-yellow-100 {
background-color: $yellow-100 !important;
}
.bg-yellow-200 {
background-color: $yellow-200 !important;
}
.bg-yellow-300 {
background-color: $yellow-300 !important;
}
.bg-red-000 {
background-color: $red-000 !important;
}
.bg-red-100 {
background-color: $red-100 !important;
}
.bg-red-200 {
background-color: $red-200 !important;
}
.bg-red-300 {
background-color: $red-300 !important;
}

View File

@ -1,38 +0,0 @@
// stylelint-disable primer/selector-no-utility
//
// Utility classes for layout
//
// Display
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-none { display: none !important; }
@each $media-query in map-keys($media-queries) {
@for $i from 1 through length($spacers) {
@include mq($media-query) {
$size: #{map-get($spacers, sp-#{$i - 1})};
$scale: #{$i - 1};
// .d-sm-block, .d-md-none, .d-lg-inline
.d-#{$media-query}-block { display: block !important; }
.d-#{$media-query}-flex { display: flex !important; }
.d-#{$media-query}-inline { display: inline !important; }
.d-#{$media-query}-inline-block { display: inline-block !important; }
.d-#{$media-query}-none { display: none !important; }
}
}
}
// Vertical alignment
.v-align-baseline { vertical-align: baseline !important; }
.v-align-bottom { vertical-align: bottom !important; }
.v-align-middle { vertical-align: middle !important; }
.v-align-text-bottom { vertical-align: text-bottom !important; }
.v-align-text-top { vertical-align: text-top !important; }
.v-align-top { vertical-align: top !important; }

View File

@ -1,11 +0,0 @@
//
// Utility classes for lists
//
// stylelint-disable primer/selector-no-utility
.list-style-none {
padding: 0 !important;
margin: 0 !important;
list-style: none !important;
}

View File

@ -1,121 +0,0 @@
//
// Utility classes for margins and padding
//
// scss-lint:disable SpaceAfterPropertyName
// stylelint-disable block-opening-brace-space-after, block-opening-brace-space-before, primer/selector-no-utility
// Margin spacer utilities
@for $i from 1 through length($spacers) {
$size: #{map-get($spacers, sp-#{$i - 1})};
$scale: #{$i - 1};
// .m-0, .m-1, .m-2...
.m-#{$scale} { margin: #{$size} !important; }
.mt-#{$scale} { margin-top: #{$size} !important; }
.mr-#{$scale} { margin-right: #{$size} !important; }
.mb-#{$scale} { margin-bottom: #{$size} !important; }
.ml-#{$scale} { margin-left: #{$size} !important; }
.mx-#{$scale} {
margin-right: #{$size} !important;
margin-left: #{$size} !important;
}
.my-#{$scale} {
margin-top: #{$size} !important;
margin-bottom: #{$size} !important;
}
.mxn-#{$scale} {
margin-right: -#{$size} !important;
margin-left: -#{$size} !important;
}
}
.mx-auto {
margin-right: auto !important;
margin-left: auto !important;
}
@each $media-query in map-keys($media-queries) {
@for $i from 1 through length($spacers) {
@include mq($media-query) {
$size: #{map-get($spacers, sp-#{$i - 1})};
$scale: #{$i - 1};
// .m-sm-0, .m-md-1, .m-lg-2...
.m-#{$media-query}-#{$scale} { margin: #{$size} !important; }
.mt-#{$media-query}-#{$scale} { margin-top: #{$size} !important; }
.mr-#{$media-query}-#{$scale} { margin-right: #{$size} !important; }
.mb-#{$media-query}-#{$scale} { margin-bottom: #{$size} !important; }
.ml-#{$media-query}-#{$scale} { margin-left: #{$size} !important; }
.mx-#{$media-query}-#{$scale} {
margin-right: #{$size} !important;
margin-left: #{$size} !important;
}
.my-#{$media-query}-#{$scale} {
margin-top: #{$size} !important;
margin-bottom: #{$size} !important;
}
.mxn-#{$media-query}-#{$scale} {
margin-right: -#{$size} !important;
margin-left: -#{$size} !important;
}
}
}
}
// Padding spacer utilities
@for $i from 1 through length($spacers) {
$size: #{map-get($spacers, sp-#{$i - 1})};
$scale: #{$i - 1};
// .p-0, .p-1, .p-2...
.p-#{$scale} { padding: #{$size} !important; }
.pt-#{$scale} { padding-top: #{$size} !important; }
.pr-#{$scale} { padding-right: #{$size} !important; }
.pb-#{$scale} { padding-bottom: #{$size} !important; }
.pl-#{$scale} { padding-left: #{$size} !important; }
.px-#{$scale} {
padding-right: #{$size} !important;
padding-left: #{$size} !important;
}
.py-#{$scale} {
padding-top: #{$size} !important;
padding-bottom: #{$size} !important;
}
}
@each $media-query in map-keys($media-queries) {
@include mq($media-query) {
@for $i from 1 through length($spacers) {
$size: #{map-get($spacers, sp-#{$i - 1})};
$scale: #{$i - 1};
// .p-sm-0, .p-md-1, .p-lg-2...
.p-#{$media-query}-#{$scale} { padding: #{$size} !important; }
.pt-#{$media-query}-#{$scale} { padding-top: #{$size} !important; }
.pr-#{$media-query}-#{$scale} { padding-right: #{$size} !important; }
.pb-#{$media-query}-#{$scale} { padding-bottom: #{$size} !important; }
.pl-#{$media-query}-#{$scale} { padding-left: #{$size} !important; }
.px-#{$media-query}-#{$scale} {
padding-right: #{$size} !important;
padding-left: #{$size} !important;
}
.py-#{$media-query}-#{$scale} {
padding-top: #{$size} !important;
padding-bottom: #{$size} !important;
}
}
}
}

View File

@ -1,91 +0,0 @@
//
// Utility classes for typography
//
// stylelint-disable primer/selector-no-utility
.fs-1 {
@include fs-1;
}
.fs-2 {
@include fs-2;
}
.fs-3 {
@include fs-3;
}
.fs-4 {
@include fs-4;
}
.fs-5 {
@include fs-5;
}
.fs-6 {
@include fs-6;
}
.fs-7 {
@include fs-7;
}
.fs-8 {
@include fs-8;
}
.fs-9 {
@include fs-9;
}
.fs-10 {
@include fs-10;
}
.fw-300 {
font-weight: 300 !important;
}
.fw-400 {
font-weight: 400 !important;
}
.fw-500 {
font-weight: 500 !important;
}
.fw-700 {
font-weight: 700 !important;
}
.lh-0 {
line-height: 0 !important;
}
.lh-default {
line-height: $body-line-height;
}
.lh-tight {
line-height: $body-heading-line-height;
}
.ls-5 {
letter-spacing: 0.05em !important;
}
.ls-10 {
letter-spacing: 0.1em !important;
}
.ls-0 {
letter-spacing: 0 !important;
}
.text-uppercase {
text-transform: uppercase !important;
}
// stylelint-enable primer/selector-no-utility

View File

@ -1,5 +0,0 @@
@import "./colors";
@import "./layout";
@import "./typography";
@import "./lists";
@import "./spacing";

View File

@ -1,78 +0,0 @@
# normalize.scss v0.1.0
Normalize.scss is the SCSS version of [normalize.css](http://necolas.github.io/normalize.css), a customisable CSS file that makes browsers render all elements more consistently and in line with modern standards.
[View the normalize.css test file](http://necolas.github.io/normalize.css/latest/test.html)
## Install
* [npm](http://npmjs.org/): `npm install --save normalize.scss`
* [Component(1)](https://github.com/component/component/): `component install guerrero/normalize.scss`
* [Bower](http://bower.io/): `bower install --save normalize.scss`
* Download: Go to [this link](https://raw.githubusercontent.com/guerrero/normalize.scss/master/normalize.scss), press right-click on the page and choose "Save as..."
No other styles should come before Normalize.scss.
It's recommendable to modify `normalize.scss` to suit it to your project
## What does it do?
* Preserves useful defaults, unlike many CSS resets.
* Normalizes styles for a wide range of elements.
* Corrects bugs and common browser inconsistencies.
* Improves usability with subtle improvements.
* Explains what code does using detailed comments.
## Browser support
* Google Chrome (latest)
* Mozilla Firefox (latest)
* Mozilla Firefox 4
* Opera (latest)
* Apple Safari 6+
* Internet Explorer 8+
[Normalize.css v1 provides legacy browser
support](https://github.com/necolas/normalize.css/tree/v1) (IE 6+, Safari 4+),
but is no longer actively developed.
## Extended details
Additional detail and explanation of the esoteric parts of normalize.css.
#### `pre, code, kbd, samp`
The `font-family: monospace, monospace` hack fixes the inheritance and scaling
of font-size for preformated text. The duplication of `monospace` is
intentional. [Source](http://en.wikipedia.org/wiki/User:Davidgothberg/Test59).
#### `sub, sup`
Normally, using `sub` or `sup` affects the line-box height of text in all
browsers. [Source](http://gist.github.com/413930).
#### `svg:not(:root)`
Adding `overflow: hidden` fixes IE9's SVG rendering. Earlier versions of IE
don't support SVG, so we can safely use the `:not()` and `:root` selectors that
modern browsers use in the default UA stylesheets to apply this style. [SVG
Mailing List discussion](http://lists.w3.org/Archives/Public/public-svg-wg/2008JulSep/0339.html)
#### `input[type="search"]`
The search input is not fully stylable by default. In Chrome and Safari on
OSX/iOS you can't control `font`, `padding`, `border`, or `background`. In
Chrome and Safari on Windows you can't control `border` properly. It will apply
`border-width` but will only show a border color (which cannot be controlled)
for the outer 1px of that border. Applying `-webkit-appearance: textfield`
addresses these issues without removing the benefits of search inputs (e.g.
showing past searches).
#### `legend`
Adding `border: 0` corrects an IE 811 bug where `color` (yes, `color`) is not
inherited by `legend`.
## Acknowledgements
Normalize.scss is a project by [Alex Guerrero](https://github.com/guerrero) based on [normalize.css](http://necolas.github.io/normalize.css) from [Nicolas Gallagher](https://github.com/necolas), co-created with [Jonathan Neal](https://github.com/jonathantneal).

View File

@ -1,427 +0,0 @@
/*! normalize.scss v0.1.0 | MIT License | based on git.io/normalize */
/**
* 1. Set default font family to sans-serif.
* 2. Prevent iOS text size adjust after orientation change, without disabling
* user zoom.
*/
html {
font-family: sans-serif; /* 1 */
-ms-text-size-adjust: 100%; /* 2 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/**
* Remove default margin.
*/
body {
margin: 0;
}
/* HTML5 display definitions
========================================================================== */
/**
* Correct `block` display not defined for any HTML5 element in IE 8/9.
* Correct `block` display not defined for `details` or `summary` in IE 10/11
* and Firefox.
* Correct `block` display not defined for `main` in IE 11.
*/
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
menu,
nav,
section,
summary {
display: block;
}
/**
* 1. Correct `inline-block` display not defined in IE 8/9.
* 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.
*/
audio,
canvas,
progress,
video {
display: inline-block; /* 1 */
vertical-align: baseline; /* 2 */
}
/**
* Prevent modern browsers from displaying `audio` without controls.
* Remove excess height in iOS 5 devices.
*/
audio:not([controls]) {
display: none;
height: 0;
}
/**
* Address `[hidden]` styling not present in IE 8/9/10.
* Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22.
*/
[hidden],
template {
display: none;
}
/* Links
========================================================================== */
/**
* Remove the gray background color from active links in IE 10.
*/
a {
background-color: transparent;
}
/**
* Improve readability when focused and also mouse hovered in all browsers.
*/
a:active,
a:hover {
outline: 0;
}
/* Text-level semantics
========================================================================== */
/**
* Address styling not present in IE 8/9/10/11, Safari, and Chrome.
*/
abbr[title] {
border-bottom: 1px dotted;
}
/**
* Address style set to `bolder` in Firefox 4+, Safari, and Chrome.
*/
b,
strong {
font-weight: bold;
}
/**
* Address styling not present in Safari and Chrome.
*/
dfn {
font-style: italic;
}
/**
* Address variable `h1` font-size and margin within `section` and `article`
* contexts in Firefox 4+, Safari, and Chrome.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/**
* Address styling not present in IE 8/9.
*/
mark {
background: #ff0;
color: #000;
}
/**
* Address inconsistent and variable font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` affecting `line-height` in all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
/* Embedded content
========================================================================== */
/**
* Remove border when inside `a` element in IE 8/9/10.
*/
img {
border: 0;
}
/**
* Correct overflow not hidden in IE 9/10/11.
*/
svg:not(:root) {
overflow: hidden;
}
/* Grouping content
========================================================================== */
/**
* Address margin not present in IE 8/9 and Safari.
*/
figure {
margin: 1em 40px;
}
/**
* Address differences between Firefox and other browsers.
*/
hr {
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 0;
}
/**
* Contain overflow in all browsers.
*/
pre {
overflow: auto;
}
/**
* Address odd `em`-unit font size rendering in all browsers.
*/
code,
kbd,
pre,
samp {
font-family: monospace, monospace;
font-size: 1em;
}
/* Forms
========================================================================== */
/**
* Known limitation: by default, Chrome and Safari on OS X allow very limited
* styling of `select`, unless a `border` property is set.
*/
/**
* 1. Correct color not being inherited.
* Known issue: affects color of disabled elements.
* 2. Correct font properties not being inherited.
* 3. Address margins set differently in Firefox 4+, Safari, and Chrome.
*/
button,
input,
optgroup,
select,
textarea {
color: inherit; /* 1 */
font: inherit; /* 2 */
margin: 0; /* 3 */
}
/**
* Address `overflow` set to `hidden` in IE 8/9/10/11.
*/
button {
overflow: visible;
}
/**
* Address inconsistent `text-transform` inheritance for `button` and `select`.
* All other form control elements do not inherit `text-transform` values.
* Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.
* Correct `select` style inheritance in Firefox.
*/
button,
select {
text-transform: none;
}
/**
* 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
* and `video` controls.
* 2. Correct inability to style clickable `input` types in iOS.
* 3. Improve usability and consistency of cursor style between image-type
* `input` and others.
*/
button,
html input[type="button"], /* 1 */
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button; /* 2 */
cursor: pointer; /* 3 */
}
/**
* Re-set default cursor for disabled elements.
*/
button[disabled],
html input[disabled] {
cursor: default;
}
/**
* Remove inner padding and border in Firefox 4+.
*/
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
/**
* Address Firefox 4+ setting `line-height` on `input` using `!important` in
* the UA stylesheet.
*/
input {
line-height: normal;
}
/**
* It's recommended that you don't attempt to style these elements.
* Firefox's implementation doesn't respect box-sizing, padding, or width.
*
* 1. Address box sizing set to `content-box` in IE 8/9/10.
* 2. Remove excess padding in IE 8/9/10.
*/
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/**
* Fix the cursor style for Chrome's increment/decrement buttons. For certain
* `font-size` values of the `input`, it causes the cursor style of the
* decrement button to change from `default` to `text`.
*/
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
height: auto;
}
/**
* 1. Address `appearance` set to `searchfield` in Safari and Chrome.
* 2. Address `box-sizing` set to `border-box` in Safari and Chrome
* (include `-moz` to future-proof).
*/
input[type="search"] {
-webkit-appearance: textfield; /* 1 */
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box; /* 2 */
box-sizing: content-box;
}
/**
* Remove inner padding and search cancel button in Safari and Chrome on OS X.
* Safari (but not Chrome) clips the cancel button when the search input has
* padding (and `textfield` appearance).
*/
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* Define consistent border, margin, and padding.
*/
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
/**
* 1. Correct `color` not being inherited in IE 8/9/10/11.
* 2. Remove padding so people aren't caught out if they zero out fieldsets.
*/
legend {
border: 0; /* 1 */
padding: 0; /* 2 */
}
/**
* Remove default vertical scrollbar in IE 8/9/10/11.
*/
textarea {
overflow: auto;
}
/**
* Don't inherit the `font-weight` (applied by a rule above).
* NOTE: the default cannot safely be changed in Chrome and Safari on OS X.
*/
optgroup {
font-weight: bold;
}
/* Tables
========================================================================== */
/**
* Remove most spacing between table cells.
*/
table {
border-collapse: collapse;
border-spacing: 0;
}
td,
th {
padding: 0;
}

View File

@ -1,70 +0,0 @@
{
"_args": [
[
"normalize.scss",
"/Users/pmarsceill/_projects/just-the-docs"
]
],
"_from": "normalize.scss@*",
"_id": "normalize.scss@0.1.0",
"_inCache": true,
"_installable": true,
"_location": "/normalize.scss",
"_nodeVersion": "0.10.32",
"_npmUser": {
"email": "alexguerrero1092@gmail.com",
"name": "alexguerrero"
},
"_npmVersion": "2.0.2",
"_phantomChildren": {},
"_requested": {
"name": "normalize.scss",
"raw": "normalize.scss",
"rawSpec": "",
"scope": null,
"spec": "*",
"type": "range"
},
"_requiredBy": [
"#DEV:/"
],
"_resolved": "https://registry.npmjs.org/normalize.scss/-/normalize.scss-0.1.0.tgz",
"_shasum": "4a21dc25bd4c019c857785f829b658aba2a8f9ab",
"_shrinkwrap": null,
"_spec": "normalize.scss",
"_where": "/Users/pmarsceill/_projects/just-the-docs",
"author": "",
"bugs": {
"url": "https://github.com/guerrero/normalize.scss/issues"
},
"dependencies": {},
"description": "Normalize.scss as a node packaged module",
"devDependencies": {},
"directories": {},
"dist": {
"shasum": "4a21dc25bd4c019c857785f829b658aba2a8f9ab",
"tarball": "https://registry.npmjs.org/normalize.scss/-/normalize.scss-0.1.0.tgz"
},
"files": [
"normalize.scss"
],
"gitHead": "d67d517e28615a873066438af1d4845c157c9baf",
"homepage": "https://github.com/guerrero/normalize.scss",
"license": "MIT",
"maintainers": [
{
"name": "alexguerrero",
"email": "alexguerrero1092@gmail.com"
}
],
"name": "normalize.scss",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git://github.com/guerrero/normalize.scss.git"
},
"scripts": {},
"style": "normalize.scss",
"version": "0.1.0"
}

View File

@ -1,12 +0,0 @@
---
---
{
{% for page in site.html_pages %}"{{ forloop.index0 }}": {
"id": "{{ forloop.index0 }}",
"title": "{{ page.title | xml_escape }}",
"content": "{{ page.content | markdownify | strip_html | xml_escape | remove: 'Table of contents' | strip_newlines | replace: '\', ' ' }}",
"url": "{{ page.url | absolute_url | xml_escape }}",
"relUrl": "{{ page.url | xml_escape }}"
}{% if forloop.last %}{% else %},
{% endif %}{% endfor %}
}

View File

@ -0,0 +1,6 @@
// todo: figure out why none of these actually do anything at all
$enable-gradients: false;
$enable-rounded: false;
$enable-shadows: false;
$secondary: #4CAF50;

128
docs/config.toml Normal file
View File

@ -0,0 +1,128 @@
baseURL = "https://moor.simonbinder.eu/"
title = "Moor"
enableRobotsTXT = true
# Hugo allows theme composition (and inheritance). The precedence is from left to right.
theme = ["docsy"]
# Will give values to .Lastmod etc.
enableGitInfo = true
# Language settings
contentDir = "content/en"
defaultContentLanguage = "en"
defaultContentLanguageInSubdir = false
# Useful when translating.
#enableMissingTranslationPlaceholders = true
disableKinds = ["taxonomy", "taxonomyTerm"]
# Highlighting config
pygmentsCodeFences = true
pygmentsUseClasses = false
# Use the new Chroma Go highlighter in Hugo.
pygmentsUseClassic = false
#pygmentsOptions = "linenos=table"
# See https://help.farbox.com/pygments.html
pygmentsStyle = "vs"
# First one is picked as the Twitter card image if not set on page.
#images = ["images/project-illustration.png"]
# Configure how URLs look like per section.
[permalinks]
blog = "/:section/:year/:month/:day/:slug/"
## Configuration for BlackFriday markdown parser: https://github.com/russross/blackfriday
[blackfriday]
plainIDAnchors = true
hrefTargetBlank = true
angledQuotes = false
latexDashes = true
# Image processing configuration.
[imaging]
resampleFilter = "CatmullRom"
quality = 75
anchor = "smart"
[services]
[services.googleAnalytics]
# Comment out the next line to disable GA tracking. Also disables the feature described in [params.ui.feedback].
#id = "UA-00000000-0"
# Language configuration
[languages]
[languages.en]
title = "Moor"
description = "A typesafe persistence library for Dart apps"
languageName ="English"
# Weight used for sorting.
weight = 1
#[languages.no]
#title = "Goldydocs"
#description = "Docsy er operativsystem for skyen"
#languageName ="Norsk"
#contentDir = "content/no"
#time_format_default = "02.01.2006"
#time_format_blog = "02.01.2006"
# Additional menu items to GitHub and pub
[[menu.main]]
name = "Pub"
weight = 100
url = "https://pub.dev/packages/moor_flutter"
[[menu.main]]
name = "GitHub"
weight = 110
url = "https://github.com/simolus3/moor/"
# Everything below this are Site Params
[params]
copyright = "Simon Binder"
#privacy_policy = "https://policies.google.com/privacy"
# Menu title if your navbar has a versions selector to access old versions of your site.
# This menu appears only if you have at least one [params.versions] set.
version_menu = "Releases"
# Repository configuration (URLs for in-page links to opening issues and suggesting changes)
github_repo = "https://github.com/simolus3/moor"
# Specify a value here if your content directory is not in your repo's root directory
github_subdir = "docs"
# Google Custom Search Engine ID. Remove or comment out to disable search.
gcs_engine_id = " 002567324444333206795:_yptu7lact8 "
# User interface configuration
[params.ui]
# Enable to show the side bar menu in its compact state.
sidebar_menu_compact = false
# Set to true to disable breadcrumb navigation.
breadcrumb_disable = false
# Set to true to hide the sidebar search box (the top nav search box will still be displayed if search is enabled)
sidebar_search_disable = false
# Set to false if you don't want to display a logo (/assets/icons/logo.svg) in the top nav bar
navbar_logo = false
[params.links]
# End user relevant links. These will show up on left side of footer and in the community page if you have one.
[[params.links.user]]
name = "Contact me via e-mail"
url = "mailto:oss@simonbinder.eu"
icon = "fa fa-envelope"
[[params.links.user]]
name = "Contact me via gitter"
url = "https://gitter.im/simolus3"
icon = "fab fa-gitter"
[[params.links.user]]
name = "Project on GitHub"
url = "https://github.com/simolus3/moor"
icon = "fab fa-github"
desc = "Development takes place here!"
# could also add another with params.links.developer. They appear on the right

View File

@ -0,0 +1,45 @@
---
title: "Moor"
linkTitle: "Moor"
---
{{< blocks/cover title="Moor: Persistence library for Dart" image_anchor="top" height="med" color="indigo" >}}
<div class="mx-auto">
<a class="btn btn-lg btn-primary mr-3 mb-4" href="{{< relref "/docs" >}}">
Learn More <i class="fas fa-arrow-alt-circle-right ml-2"></i>
</a>
<a class="btn btn-lg btn-secondary mr-3 mb-4" href="https://pub.dev/packages/moor_flutter">
Get fom pub <i class="fas fa-code ml-2 "></i>
</a>
</div>
{{< /blocks/cover >}}
{{% blocks/lead color="dark" %}}
Moor is an easy to use, reactive persistence library for Flutter apps. Define your
database tables in pure Dart and enjoy a fluent query API, auto-updating streams
and more!
{{% /blocks/lead %}}
{{< blocks/section color="primary" >}}
{{% blocks/feature icon="fa-lightbulb" title="Declarative tables, fluent queries!" %}}
With moor, you can write your database tables in pure Dart without having to miss out on
advanced sqlite features. Moor will take care of creating the tables and generate code
that allows you run fluent queries on your data.
[Get started now]({{< ref "/docs/Getting started/_index.md" >}})
{{% /blocks/feature %}}
{{% blocks/feature icon="fas fa-database" title="Prefer SQL? Moor got you covered!" url="https://moor.simonbinder.eu/queries/custom" %}}
Moor contains a powerful sql parser and analyzer, allowing it to create typesafe APIs for all your sql queries. All queries are
validated and analyzed during build-time, so moor can provide hints about potential errors quickly and generate efficient mapping
code.
{{% /blocks/feature %}}
{{% blocks/feature icon="fas fa-star" title="And much more!" %}}
Moor can also provide auto-updating streams emitting new results when the underlying data changes.
Moor makes dealing with transactions easy (no special parameter to pass around everywhere),
{{% /blocks/feature %}}
{{< /blocks/section >}}

View File

@ -0,0 +1,5 @@
---
title: "Advanced features"
weight: 20
description: Learn about some advanced features of moor
---

View File

@ -1,11 +1,10 @@
---
layout: guide
title: Modularity with DAOs
nav_order: 5
permalink: /daos/
title: "DAOs"
description: Keep your database code modular with DAOs
aliases:
- /daos/
---
# Extracting functionality with DAOs
When you have a lot of queries, putting them all into one class might become
tedious. You can avoid this by extracting some queries into classes that are
available from your main database class. Consider the following code:

View File

@ -1,16 +1,16 @@
---
layout: feature
title: Table joins
parent: Writing queries
since: 1.3
permalink: /queries/joins
title: "Joins"
weight: 1
description: >
Use joins to write queries that read from more than one table
aliases:
- /queries/joins
---
# Joins
Moor supports sql joins to write queries that operate on more than one table. To use that feature, start
a select regular select statement with `select(table)` and then add a list of joins using `.join()`. For
inner and left outer joins, a `ON` expression needs to be specified. Here's an example using the tables
defined in the [example]({{ site.common_links.getting_started | absolute_url }}).
defined in the [example]({{< relref "../Getting started/_index.md" >}}).
```dart
// we define a data class to contain both a todo entry and the associated category
@ -34,7 +34,7 @@ Stream<List<EntryWithCategory>> entriesWithCategory() {
## Parsing results
Calling `get()` or `watch` on a select statement with join returns a `Future` or `Stream` of
`List<TypedResult>` respectively. Each `TypedResult` represents a row from which data can be
read. It contains a `rawData` getter to obtain the raw row. But more importantly, the
read. It contains a `rawData` getter to obtain the raw columns. But more importantly, the
`readTable` method can be used to read a data class from a table.
In the example query above, we can read the todo entry and the category from each row like this:
@ -50,7 +50,7 @@ return query.watch().map((rows) {
```
_Note_: `readTable` returns `null` when an entity is not present in the row. For instance, todo entries
might not be in any category. In that case, `row.readTable(categories)` returns `null`.
might not be in any category. If we a row without a category, `row.readTable(categories)` would return `null`.
## Aliases
Sometimes, a query references a table more than once. Consider the following example to store saved routes for a
navigation system:

View File

@ -1,10 +1,12 @@
---
layout: feature
title: Migrations
nav_order: 4
permalink: /migrations/
title: "Migrations"
weight: 10
description: >
Define what happens when your database gets created or updated
aliases:
- /migrations
---
# Migrations
Moor provides a migration API that can be used to gradually apply schema changes after bumping
the `schemaVersion` getter inside the `Database` class. To use it, override the `migration`
getter. Here's an example: Let's say you wanted to add a due date to your todo entries:

View File

@ -1,16 +1,14 @@
---
layout: feature
title: Type converters
since: 1.7
nav_order: 8
permalink: /type_converters
title: "Type converters"
description: >
Store more complex data in columns with type converters
---
# Type converters
Moor supports a variety of types out of the box, but sometimes you need to store more complex types.
Moor supports a variety of types out of the box, but sometimes you need to store more complex data.
You can achieve this by using `TypeConverters`. In this example, we'll use the the
[json_serializable](https://pub.dev/packages/json_annotation) package to store a custom object in a
column. Moor supports any Dart object, but using that package can make serialization easier.
text column. Moor supports any Dart type for which you provide a `TypeConverter`, we're using that
package here to make the example simpler.
```dart
import 'dart:convert';

View File

@ -1,4 +1,19 @@
### Adding the dependency
---
title: "Getting Started"
linkTitle: "Getting Started"
weight: 2
description: >
Simple guide to get a moor project up and running
aliases:
- /getting-started/ # Used to have this url
---
_Note:_ If you prefer a tutorial video, Reso Coder has made a detailed video explaining
how to get started. You can watch it [here](https://youtu.be/zpWsedYMczM).
## Adding the dependency
First, let's add moor to your project's `pubspec.yaml`.
At the moment, the current version of `moor_flutter` is [![Flutter version](https://img.shields.io/pub/v/moor_flutter.svg)](https://pub.dartlang.org/packages/moor_flutter) and the current version of `moor_generator` is [![Generator version](https://img.shields.io/pub/v/moor_generator.svg)](https://pub.dartlang.org/packages/moor_generator)
@ -55,7 +70,7 @@ compile time. For column definitions and the primary key, the function must use
operator and can't contain anything more than what's included in the documentation and the
examples. Otherwise, the generator won't be able to know what's going on.
### Generating the code
## Generating the code
Moor integrates with Dart's `build` system, so you can generate all the code needed with
`flutter packages pub run build_runner build`. If you want to continuously rebuild the generated code
whever you change your code, run `flutter packages pub run build_runner watch` instead.

View File

@ -1,21 +1,26 @@
---
layout: guide
title: Writing queries
nav_order: 2
has_children: true
permalink: /queries/
title: "Writing queries"
linkTitle: "Writing queries"
description: >
Learn how to write database queries in pure Dart with moor
aliases:
- /queries/
---
__Note__: This assumes that you already have your database class ready.
Follow the [instructions][getting-started] over here on how to do that.
{{% pageinfo %}}
__Note__: This assumes that you already completed [the setup]({{< ref "_index.md" >}}).
{{% /pageinfo %}}
# Writing queries
The examples here use the tables defined [here][getting-started].
For each table you've specified in the `@UseMoor` annotation on your database class,
a corresponding getter for a table will be generated. That getter can be used to
run statements:
```dart
// inside the database class, the `todos` getter has been created by moor.
@UseMoor(tables: [Todos, Categories])
class MyDatabase extends _$MyDatabase {
// the schemaVersion getter and the constructor from the previous page
// have been omitted.
// loads all todo entries
Future<List<Todo>> get allTodoEntries => select(todos).get();
@ -25,6 +30,7 @@ Future<List<Todo>> get allTodoEntries => select(todos).get();
Stream<List<TodoEntry>> watchEntriesInCategory(Category c) {
return (select(todos)..where((t) => t.category.equals(c.id))).watch();
}
}
```
## Select statements
You can create `select` statements by starting them with `select(tableName)`, where the
@ -105,5 +111,3 @@ addTodoEntry(
If a column is nullable or has a default value (this includes auto-increments), the field
can be omitted. All other fields must be set and non-null. The `insert` method will throw
otherwise.
[getting-started]: {{ site.common_links.getting_started | absolute_url }}

View File

@ -0,0 +1,5 @@
---
title: "Other engines"
weight: 100
description: Use moor on the web or other platforms
---

View File

@ -0,0 +1,31 @@
---
title: Encryption
description: Use moor on encrypted databases
---
{{% alert title="Security notice" color="warning" %}}
> This feature uses an external library for all the encryption work. Importing
that library as described here would always pull the latest version from git
when running `pub upgrade`. If you want to be sure that you're using a safe version
that you can trust, consider pulling `sqflite_sqlcipher` and `encrypted_moor` once
and then include your local version via a path in the pubspec.
{{% /alert %}}
Starting from 1.7, we have a version of moor that can work with encrypted databases by using the
[sqflite_sqlcipher](https://github.com/davidmartos96/sqflite_sqlcipher) library
by [@davidmartos96](https://github.com/davidmartos96). To use it, you need to
remove the dependency on `moor_flutter` from your `pubspec.yaml` and replace it
with this:
```yaml
dependencies:
moor: "$latest version"
encrypted_moor:
git:
url: https://github.com/simolus3/moor.git
path: extras/encryption
```
Instead of importing `package:moor_flutter/moor_flutter` in your apps, you would then import
both `package:moor/moor.dart` and `package:encrypted_moor/encrypted_moor.dart`.
Finally, you can replace `FlutterQueryExecutor` with an `EncryptedExecutor`.

View File

@ -0,0 +1,12 @@
---
title: Dart VM
description: An upcoming version will have a version for the Dart VM
---
An upcoming version of moor will have first class support for the Dart VM,
so you can use moor on Desktop Flutter applications or Dart apps.
We're going to use the `dart:ffi` feature for that, which itself is an
experimental state at the moment. We already have a version of moor that
runs on the Dart VM (see [#76](https://github.com/simolus3/moor/issues/76))
and we're going to release it when `dart:ffi` becomes stable.

View File

@ -1,17 +1,13 @@
---
layout: feature
title: Web support
nav_order: 7
since: 1.6
permalink: /web
url: /web
---
# Web support
Starting from moor `1.6`, you can experimentally use moor in Dart webapps. Moor web supports
Flutter Web, AngularDart, plain `dart:html` or any other web framework.
## Getting started
Instead of depending on `moor_flutter`, you need to depend on on `moor` directly. Apart from that, you can
Instead of depending on `moor_flutter` in your pubspec, you need to depend on on `moor` directly. Apart from that, you can
follow the [getting started guide]({{ site.common_links.getting_started | absolute_url }}).
Also, instead of using a `FlutterQueryExecutor` in your database classes, you can use a `WebDatabase` executor:
```dart

View File

@ -0,0 +1,10 @@
---
title: "Using SQL"
weight: 30
description: Write typesafe sql with moor
---
Moor let's you express a variety of queries in pure Dart. However, you don't have to miss out
on its features when you need more complex queries or simply prefer sql. Moor has a builtin
sql parser and analyzer, so it can generate a typesafe API for sql statements you write.
It can also warn about errors in your sql at build time.

View File

@ -1,21 +1,21 @@
---
layout: feature
title: Custom queries
parent: Writing queries
permalink: /queries/custom
title: "Custom queries"
weight: 10
description: Let moor generate Dart from your SQL statements
aliases:
- /queries/custom
---
# Custom statements
Altough moor includes a fluent api that can be used to model most statements, advanced
features like `GROUP BY` statements or window functions are not yet supported. You can
use these features with custom statements. You don't have to miss out on other benefits
moor brings, though: Parsing the rows and query-streams also work on custom statements.
moor brings, though: Moor helps you parse the result rows and qustom queries also
support auto-updating streams.
## Statements with a generated api
Starting from version `1.5`, you can instruct moor to automatically generate a typesafe
API for your select statements. At the moment, this feature is in an experimental state
but it can already handle most statements (`select`, `update` and `delete`). Of course,
you can still write custom sql manually. See the sections below for details.
API for your select, update and delete statements. Of course, you can still write custom
sql manually. See the sections below for details.
To use this feature, all you need to is define your queries in your `UseMoor` annotation:
```dart
@ -35,19 +35,21 @@ it will hold the result of your query. Also, the `_$MyDatabase` class from which
methods `categoriesWithCount` (which runs the query once) and `watchCategoriesWithCount` (which returns
an auto-updating stream).
Queries can have parameters in them by using the `?` or `:name` syntax. When your queries contain parameters,
Queries can have parameters in them by using the `?` or `:name` syntax. When your queries contains parameters,
moor will figure out an appropriate type for them and include them in the generated methods. For instance,
`'categoryById': 'SELECT * FROM categories WHERE id = :id'` will generate the method `categoryById(int id)`.
You can also use `UPDATE` or `DELETE` statements here. Of course, this feature is also available for [daos]({{"/daos" | absolute_url}}),
You can also use `UPDATE` or `DELETE` statements here. Of course, this feature is also available for
[daos]({{< relref "../Advanced Features/daos.md" >}}),
and it perfectly integrates with auto-updating streams by analyzing what tables you're reading from or
writing to.
## Custom select statements
You can issue custom queries by calling `customSelect` for a one-time query or
If you don't want to use the statements with an generated api, you can
still send custom queries by calling `customSelect` for a one-time query or
`customSelectStream` for a query stream that automatically emits a new set of items when
the underlying data changes. Using the todo example introduced in the
[getting started guide]({{site.common_links.getting_started | absolute_url}}), we can
[getting started guide]({{< ref "/docs/Getting started/_index.md" >}}), we can
write this query which will load the amount of todo entries in each category:
```dart
class CategoryWithCount {

View File

@ -0,0 +1,42 @@
---
title: "Tables from SQL"
weight: 20
description: Generate tables from `CREATE TABLE` statements.
---
{{% alert title="Experimental feature" %}}
At the moment, creating table classes from `CREATE TABLE` statements is an experimental feature.
If you run into any issues, please create an issue and let us know, thanks!
{{% /alert %}}
With moor, you can specify your table classes in Dart and it will generate matching
`CREATE TABLE` statements for you. But if you prefer to write `CREATE TABLE` statements and have
moor generating fitting Dart classes, that works too.
To use this feature, create a (or multiple) `.moor` file somewhere in your project. You can fill
them with create table statements:
```sql
CREATE TABLE states (
id INT NOT NULL PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL
);
CREATE TABLE experiments (
id INT NOT NULL PRIMARY KEY AUTOINCREMENT,
description TEXT NOT NULL,
state INT REFERENCES states(id) ON UPDATE CASCADE ON DELETE SET NULL
)
```
Then, import these tables to your database with:
```dart
@UseMoor(include: {'experiments.moor'})
class ExperimentsDb extends _$ExperimentsDb {
```
All the tables will then be available inside your database class, just like they
would be if you wrote them in Dart. If you want to use this feature on an DAO,
you'll also need to `include` the .moor file on that class. Moor supports both
relative imports (like above) and absolute imports (like `package:your_app/src/tables/experiments.moor`)
Of course, this feature works perfectly together with features like generated
custom queries and query-streams.

32
docs/content/en/docs/_index.md Executable file
View File

@ -0,0 +1,32 @@
---
title: "Welcome to Moor"
linkTitle: "Documentation"
weight: 20
menu:
main:
weight: 20
description: >
Welcome to the moor documentation. This site shows you what moor can do and how to use it.
---
## So what's moor?
Moor is a reactive persistence library for Dart and Flutter applications. It's built ontop
of database libraries like [sqflite](https://pub.dev/packages/sqflite) or [sql.js](https://github.com/kripken/sql.js/)
and provides additional featues, like
- __Type safety__: Instead of writing sql queries manually and parsing the `List<Map<String, dynamic>>` that they
return, moor turns rows into object of your choice.
- __Stream queries__: Moor let's you "watch" your queries with zero additional effort. Any query can be turned into
an auto-updating stream that emits new items when the underlying data changes.
- __Fluent queries__: Moor generates a Dart api that you can use to write queries and automatically get their results.
Keep an updated list of all users with `select(users).watch()`. That's it! No sql to write, no rows to parse.
- __Typesafe sql__: If you prefer to write sql, that's fine! Moor has an sql parser and analyzer built in. It can parse
your queries at compile time, figure out what columns they're going to return and generate Dart code to represent your
rows.
- __Migration utils__: Moor makes writing migrations easier thanks to utility functions like `.createAllTables()`.
You don't need to manually write your `CREATE TABLE` statements and keep them updated.
And much more! Moor validates data before inserting it, so you can get helpful error messages instead of just an
sql error code. Of course, it supports transactions. And DAOs. And efficient batched insert statements. The list goes on.
Check out these in-depth articles to learn about moor and how to use its features.

View File

@ -0,0 +1,13 @@
---
title: "Examples"
linkTitle: "Examples"
weight: 3
description: Example apps using moor
---
We have an [example in the repo](https://github.com/simolus3/moor/tree/master/moor_flutter/example), it's a simple todo list app,
written with moor.
The [HackerNews reader app](https://github.com/filiph/hn_app) from the [Boring Flutter Show](https://www.youtube.com/playlist?list=PLjxrf2q8roU3ahJVrSgAnPjzkpGmL9Czl) also uses moor to keep a list of favorite articles.

View File

@ -1,9 +1,10 @@
---
title: Frequently asked questions
nav_order: 6
permalink: /faq/
title: "Frequently asked questions"
url: /faq/
---
## Using the database
If you've created a `MyDatabase` class by following the [getting started guide]({{site.url}}/getting-started/), you
still need to somehow obtain an instance of it. It's recommended to only have one (singleton) instance of your database,
@ -29,6 +30,7 @@ void main() {
Provider<MyDatabase>(
builder: (context) => MyDatabase(),
child: MyFlutterApp(),
dispose: (context, db) => db.close(),
),
);
}

View File

@ -1,38 +1,54 @@
---
layout: feature
title: Transactions
nav_order: 3
since: 1.1
permalink: /transactions
title: "Transactions"
weight: 70
description: Run multiple queries atomically
aliases:
- /transactions/
---
# Transactions
Moor has support for transactions and allows multiple queries to run atomically.
Moor has support for transactions and allows multiple queries to run atomically,
so that none of their changes is visible to the main database until the transaction
is finished.
To begin a transaction, call the `transaction` method on your database or a DAO.
It takes a function as an argument that will be run on the transaction. In the
It takes a function as an argument that will be run transactionally. In the
following example, which deals with deleting a category, we move all todo entries
in that category back to the default category:
```dart
Future deleteCategory(Category category) {
return transaction((t) async {
return transaction((_) async {
// first, move the affected todo entries back to the default category
await t.customUpdate(
await customUpdate(
'UPDATE todos SET category = NULL WHERE category = ?',
updates: {todos},
variables: [Variable.withInt(category.id)],
);
// then, delete the category
await t.delete(categories).delete(category);
await delete(categories).delete(category);
});
}
```
{{% alert title="About that _" color="info" %}}
You might have noticed that `_` parameter on the `transaction()` callback. That parameter would
be a special version of the database that runs all the methods called on it inside the transaction.
In previous moor versions, it was important to call everything on that parameter, e.g.
```dart
transaction((db) async {
await db.delete(categories).delete(category);
});
```
Starting from moor 1.6, this is no longer neccessary, we can figure out that you meant to run that
in a transaction because it was called from inside a `transaction` callback. We're going to remove
that parameter entirely in moor 2.0.
{{% /alert %}}
## ⚠️ Gotchas
There are a couple of things that should be kept in mind when working with transactions:
1. __Await all calls__: All queries inside the transaction must be `await`-ed. The transaction
will complete when the inner method completes. Without `await`, some queries might be operating
on the transaction after it has been closed!
on the transaction after it has been closed! This can cause data loss or runtime crashes.
2. __No select streams in transactions__: Inside a `transaction` callback, select statements can't
be `.watch()`ed. The reasons behind this is that it's unclear how a stream should behave when a
transaction completes. Should the stream complete as well? Update to data changes made outside of the

View File

@ -0,0 +1,6 @@
---
title: Search Results
layout: search
---

View File

@ -1,20 +0,0 @@
---
layout: guide
title: Getting started
nav_order: 1
permalink: /getting-started/
---
# Getting started
_Note:_ If you prefer a tutorial video, Reso Coder has made a detailed video explaining
how to get started. You can watch it [here](https://youtu.be/zpWsedYMczM).
{% include content/getting_started.md %}
Congratulations, you now have a class which you can use to easily write queries.
A detailed guide on how to do that in Dart is written [here]({{"/queries" | absolute_url}}).
If you prefer to write SQL and have moor generate the mapping out, check out
[custom queries]({{"queries/custom" | absolute_url}})
PS: You might be asking how you would actually obtain an instance of `MyDatabase` for
your widgets. If so, [here]({{site.url}}/faq/#using-the-database) is some guidance.

View File

@ -1,74 +0,0 @@
---
layout: home
title: Home
meta_title: Moor - Reactive persistence library for Dart
description: Moor is an easy to use, typesafe and reactive persistence library for Flutter and webapps written in Dart.
nav_order: 0
---
# Moor - persistence library for Dart
{: .fs-9 }
Moor is an easy to use, reactive persistence library for Flutter apps. Define your
database tables in pure Dart and enjoy a fluent query API, auto-updating streams
and more!
{: .fs-6 .fw-300 }
[![Build Status](https://api.cirrus-ci.com/github/simolus3/moor.svg)](https://cirrus-ci.com/github/simolus3/moor)
[![codecov](https://codecov.io/gh/simolus3/moor/branch/master/graph/badge.svg)](https://codecov.io/gh/simolus3/moor)
[Get started now]({{ site.common_links.getting_started | absolute_url }}){: .btn .btn-green .fs-5 .mb-4 .mb-md-0 .mr-2 }
[View on GitHub]({{site.github_link}}){: .btn .btn-outline .fs-5 .mb-4 .mb-md-0 .mr-2 }
---
## Declarative tables
With moor, you can declare your tables in pure dart without having to miss out on advanced sqlite
features. Moor will take care of writing the `CREATE TABLE` statements when the database is created.
## Fluent queries
Thanks to the power of Dart build system, moor will let you write typesafe queries:
```dart
Future<User> userById(int id) {
return (select(users)..where((user) => user.id.equals(id))).getSingle();
// runs SELECT * FROM users WHERE id = ?, automatically binds the parameter
// and parses the result row.
}
```
No more hard to debug typos in sql, no more annoying to write mapping code - moor takes
care of all the boring parts.
## Prefer SQL? Moor got you covered
Moor contains a powerful sql parser and analyzer, allowing it to create typesafe APIs for
all your sql queries:
```dart
@UseMoor(
tables: [Categories],
queries: {
'categoryById': 'SELECT * FROM categories WHERE id = :id'
},
)
class MyDatabase extends _$MyDatabase {
// the _$MyDatabase class will have the categoryById(int id) and watchCategoryById(int id)
// methods that execute the sql and parse its result into a generated class.
```
All queries are validated and analyzed during build-time, so that moor can provide hints
about potential errors quickly and generate efficient mapping code once.
## Auto-updating streams
For all your queries, moor can generate a `Stream` that will automatically emit new results
whenever the underlying data changes. This is first-class feature that perfectly integrates
with custom queries, daos and all the other features. Having an auto-updating single source
of truth makes managing perstistent state much easier!
## And much moor...
Moor also supports transactions, DAOs, powerful helpers for migrations, batched inserts and
many more features that makes writing persistence code much easier.
## Getting started
{% include content/getting_started.md %}
You can ignore the `schemaVersion` at the moment, the important part is that you can
now run your queries with fluent Dart code
## [Writing queries]({{"queries" | absolute_url }})

8
docs/layouts/404.html Normal file
View File

@ -0,0 +1,8 @@
{{ define "main"}}
<main id="main">
<div>
<h1 id="title">Not found</h1>
<p>Oops! This page doesn't exist. Try going back to our <a href="{{ "/" | relURL }}">home page</a>.</p>
</div>
</main>
{{ end }}

2843
docs/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

24
docs/package.json Normal file
View File

@ -0,0 +1,24 @@
{
"name": "tech-doc-hugo",
"version": "0.0.1",
"description": "Hugo theme for technical documentation.",
"main": "none.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/bep/tech-doc-hugo.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/bep/tech-doc-hugo/issues"
},
"homepage": "https://github.com/bep/tech-doc-hugo#readme",
"dependencies": {},
"devDependencies": {
"autoprefixer": "^9.4.6",
"postcss-cli": "^5.0.1"
}
}

1
docs/themes/docsy vendored Submodule

@ -0,0 +1 @@
Subproject commit 97488e0b9b63fd028fc1ae21e8a18a997439b5cd

View File

@ -10,7 +10,6 @@ void transactionTests(TestExecutor executor) {
await db.transaction((_) async {
final florianId = await db.writeUser(People.florian);
print(florianId);
final dash = await db.getUserById(People.dashId);
final florian = await db.getUserById(florianId);

View File

@ -20,9 +20,14 @@ abstract class Table {
String get tableName => null;
/// Whether to append a `WITHOUT ROWID` clause in the `CREATE TABLE`
/// statement.
/// statement. This is intended to be used by generated code only.
bool get withoutRowId => false;
/// Moor will write some table constraints automatically, for instance when
/// you override [primaryKey]. You can turn this behavior off if you want to.
/// This is intended to be used by generated code only.
bool get dontWriteConstraints => false;
/// Override this to specify custom primary keys:
/// ```dart
/// class IngredientInRecipes extends Table {

View File

@ -95,8 +95,15 @@ class Migrator {
if (i < table.$columns.length - 1) context.buffer.write(', ');
}
final dslTable = table.asDslTable;
// we're in a bit of a hacky situation where we don't write the primary
// as table constraint if it has already been written on a primary key
// column, even though that column appears in table.$primaryKey because we
// need to know all primary keys for the update(table).replace(row) API
final hasPrimaryKey = table.$primaryKey?.isNotEmpty ?? false;
if (hasPrimaryKey && !hasAutoIncrement) {
final dontWritePk = dslTable.dontWriteConstraints || hasAutoIncrement;
if (hasPrimaryKey && !dontWritePk) {
context.buffer.write(', PRIMARY KEY (');
final pkList = table.$primaryKey.toList(growable: false);
for (var i = 0; i < pkList.length; i++) {
@ -109,7 +116,6 @@ class Migrator {
context.buffer.write(')');
}
final dslTable = table.asDslTable;
final constraints = dslTable.customConstraints ?? [];
for (var i = 0; i < constraints.length; i++) {

View File

@ -62,8 +62,8 @@ abstract class GeneratedColumn<T, S extends SqlType<T>> extends Column<T, S> {
// these custom constraints refer to builtin constraints from moor
writeCustomConstraints(into.buffer);
} else {
into.buffer.write($customConstraints);
} else if ($customConstraints?.isNotEmpty == true) {
into.buffer..write(' ')..write($customConstraints);
}
}

View File

@ -4,7 +4,7 @@ import 'package:moor/src/runtime/expressions/variables.dart';
/// Base class for generated classes. [TableDsl] is the type specified by the
/// user that extends [Table], [D] is the type of the data class
/// generated from the table.
mixin TableInfo<TableDsl extends Table, D extends DataClass> {
mixin TableInfo<TableDsl extends Table, D extends DataClass> on Table {
/// Type system sugar. Implementations are likely to inherit from both
/// [TableInfo] and [TableDsl] and can thus just return their instance.
TableDsl get asDslTable;
@ -13,6 +13,15 @@ mixin TableInfo<TableDsl extends Table, D extends DataClass> {
/// key has been specified.
Set<GeneratedColumn> get $primaryKey => null;
// The "primaryKey" is what users define on their table classes, the
// "$primaryKey" is what moor generates in the implementation table info
// classes. Having two of them is pretty pointless, we're going to remove
// the "$primaryKey$ getter in Moor 2.0. Until then, let's make sure they're
// consistent for classes from CREATE TABLE statements, where the info class
// and the table class is the same thing but primaryKey isn't overriden.
@override
Set<Column> get primaryKey => $primaryKey;
/// The table name in the sql table. This can be an alias for the actual table
/// name. See [actualTableName] for a table name that is not aliased.
String get $tableName;

View File

@ -122,6 +122,8 @@ class NoIds extends Table with TableInfo<NoIds, NoId> {
@override
final bool withoutRowId = true;
@override
final bool dontWriteConstraints = true;
}
class WithDefault extends DataClass implements Insertable<WithDefault> {
@ -263,6 +265,9 @@ class WithDefaults extends Table with TableInfo<WithDefaults, WithDefault> {
WithDefaults createAlias(String alias) {
return WithDefaults(_db, alias);
}
@override
final bool dontWriteConstraints = true;
}
class WithConstraint extends DataClass implements Insertable<WithConstraint> {
@ -434,6 +439,161 @@ class WithConstraints extends Table
final List<String> customConstraints = const [
'FOREIGN KEY (a, b) REFERENCES with_defaults (a, b)'
];
@override
final bool dontWriteConstraints = true;
}
class ConfigData extends DataClass implements Insertable<ConfigData> {
final String configKey;
final String configValue;
ConfigData({@required this.configKey, this.configValue});
factory ConfigData.fromData(Map<String, dynamic> data, GeneratedDatabase db,
{String prefix}) {
final effectivePrefix = prefix ?? '';
final stringType = db.typeSystem.forDartType<String>();
return ConfigData(
configKey: stringType
.mapFromDatabaseResponse(data['${effectivePrefix}config_key']),
configValue: stringType
.mapFromDatabaseResponse(data['${effectivePrefix}config_value']),
);
}
factory ConfigData.fromJson(Map<String, dynamic> json,
{ValueSerializer serializer = const ValueSerializer.defaults()}) {
return ConfigData(
configKey: serializer.fromJson<String>(json['configKey']),
configValue: serializer.fromJson<String>(json['configValue']),
);
}
@override
Map<String, dynamic> toJson(
{ValueSerializer serializer = const ValueSerializer.defaults()}) {
return {
'configKey': serializer.toJson<String>(configKey),
'configValue': serializer.toJson<String>(configValue),
};
}
@override
T createCompanion<T extends UpdateCompanion<ConfigData>>(bool nullToAbsent) {
return ConfigCompanion(
configKey: configKey == null && nullToAbsent
? const Value.absent()
: Value(configKey),
configValue: configValue == null && nullToAbsent
? const Value.absent()
: Value(configValue),
) as T;
}
ConfigData copyWith({String configKey, String configValue}) => ConfigData(
configKey: configKey ?? this.configKey,
configValue: configValue ?? this.configValue,
);
@override
String toString() {
return (StringBuffer('ConfigData(')
..write('configKey: $configKey, ')
..write('configValue: $configValue')
..write(')'))
.toString();
}
@override
int get hashCode => $mrjf($mrjc(configKey.hashCode, configValue.hashCode));
@override
bool operator ==(other) =>
identical(this, other) ||
(other is ConfigData &&
other.configKey == configKey &&
other.configValue == configValue);
}
class ConfigCompanion extends UpdateCompanion<ConfigData> {
final Value<String> configKey;
final Value<String> configValue;
const ConfigCompanion({
this.configKey = const Value.absent(),
this.configValue = const Value.absent(),
});
}
class Config extends Table with TableInfo<Config, ConfigData> {
final GeneratedDatabase _db;
final String _alias;
Config(this._db, [this._alias]);
final VerificationMeta _configKeyMeta = const VerificationMeta('configKey');
GeneratedTextColumn _configKey;
GeneratedTextColumn get configKey => _configKey ??= _constructConfigKey();
GeneratedTextColumn _constructConfigKey() {
return GeneratedTextColumn('config_key', $tableName, false,
$customConstraints: 'not null primary key');
}
final VerificationMeta _configValueMeta =
const VerificationMeta('configValue');
GeneratedTextColumn _configValue;
GeneratedTextColumn get configValue =>
_configValue ??= _constructConfigValue();
GeneratedTextColumn _constructConfigValue() {
return GeneratedTextColumn('config_value', $tableName, true,
$customConstraints: '');
}
@override
List<GeneratedColumn> get $columns => [configKey, configValue];
@override
Config get asDslTable => this;
@override
String get $tableName => _alias ?? 'config';
@override
final String actualTableName = 'config';
@override
VerificationContext validateIntegrity(ConfigCompanion d,
{bool isInserting = false}) {
final context = VerificationContext();
if (d.configKey.present) {
context.handle(_configKeyMeta,
configKey.isAcceptableValue(d.configKey.value, _configKeyMeta));
} else if (configKey.isRequired && isInserting) {
context.missing(_configKeyMeta);
}
if (d.configValue.present) {
context.handle(_configValueMeta,
configValue.isAcceptableValue(d.configValue.value, _configValueMeta));
} else if (configValue.isRequired && isInserting) {
context.missing(_configValueMeta);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {configKey};
@override
ConfigData map(Map<String, dynamic> data, {String tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : null;
return ConfigData.fromData(data, _db, prefix: effectivePrefix);
}
@override
Map<String, Variable> entityToSql(ConfigCompanion d) {
final map = <String, Variable>{};
if (d.configKey.present) {
map['config_key'] = Variable<String, StringType>(d.configKey.value);
}
if (d.configValue.present) {
map['config_value'] = Variable<String, StringType>(d.configValue.value);
}
return map;
}
@override
Config createAlias(String alias) {
return Config(_db, alias);
}
@override
final bool dontWriteConstraints = true;
}
abstract class _$CustomTablesDb extends GeneratedDatabase {
@ -446,6 +606,9 @@ abstract class _$CustomTablesDb extends GeneratedDatabase {
WithConstraints _withConstraints;
WithConstraints get withConstraints =>
_withConstraints ??= WithConstraints(this);
Config _config;
Config get config => _config ??= Config(this);
@override
List<TableInfo> get allTables => [noIds, withDefaults, withConstraints];
List<TableInfo> get allTables =>
[noIds, withDefaults, withConstraints, config];
}

View File

@ -14,3 +14,8 @@ CREATE TABLE with_constraints (
FOREIGN KEY (a, b) REFERENCES with_defaults (a, b)
)
create table config (
config_key TEXT not null primary key,
config_value TEXT
);

View File

@ -0,0 +1,43 @@
import 'package:moor/moor.dart';
import 'package:test_api/test_api.dart';
import '../data/tables/custom_tables.dart';
import '../data/utils/mocks.dart';
const _createNoIds =
'CREATE TABLE IF NOT EXISTS no_ids (payload BLOB NOT NULL) WITHOUT ROWID;';
const _createWithDefaults = 'CREATE TABLE IF NOT EXISTS with_defaults ('
"a VARCHAR DEFAULT 'something', b INTEGER UNIQUE);";
const _createWithConstraints = 'CREATE TABLE IF NOT EXISTS with_constraints ('
'a VARCHAR, b INTEGER NOT NULL, c REAL, '
'FOREIGN KEY (a, b) REFERENCES with_defaults (a, b)'
');';
const _createConfig = 'CREATE TABLE IF NOT EXISTS config ('
'config_key VARCHAR not null primary key, '
'config_value VARCHAR);';
void main() {
// see ../data/tables/tables.moor
test('creates tables as specified in .moor files', () async {
final mockExecutor = MockExecutor();
final mockQueryExecutor = MockQueryExecutor();
final db = CustomTablesDb(mockExecutor);
await Migrator(db, mockQueryExecutor).createAllTables();
verify(mockQueryExecutor.call(_createNoIds, []));
verify(mockQueryExecutor.call(_createWithDefaults, []));
verify(mockQueryExecutor.call(_createWithConstraints, []));
verify(mockQueryExecutor.call(_createConfig, []));
});
test('infers primary keys correctly', () async {
final db = CustomTablesDb(null);
expect(db.noIds.primaryKey, isEmpty);
expect(db.withDefaults.primaryKey, isEmpty);
expect(db.config.primaryKey, [db.config.configKey]);
});
}

View File

@ -93,10 +93,6 @@ class SpecifiedColumn {
/// Whether this column has auto increment.
bool get hasAI => features.any((f) => f is AutoIncrement);
/// Whether this column has been declared as the primary key via the
/// column builder. The `primaryKey` field in the table class is unrelated to
/// this.
final bool declaredAsPrimaryKey;
final List<ColumnFeature> features;
/// If this columns has custom constraints that should be used instead of the
@ -157,7 +153,6 @@ class SpecifiedColumn {
this.name,
this.overriddenJsonName,
this.customConstraints,
this.declaredAsPrimaryKey = false,
this.nullable = false,
this.features = const [],
this.defaultArgument,

View File

@ -52,6 +52,10 @@ class SpecifiedTable {
/// getter on the table class with this value.
final bool overrideWithoutRowId;
/// When non-null, the generated table class will override the
/// `dontWriteConstraint` getter on the table class with this value.
final bool overrideDontWriteConstraints;
/// When non-null, the generated table class will override the
/// `customConstraints` getter in the table class with this value.
final List<String> overrideTableConstraints;
@ -64,7 +68,8 @@ class SpecifiedTable {
this.primaryKey,
String overriddenName,
this.overrideWithoutRowId,
this.overrideTableConstraints})
this.overrideTableConstraints,
this.overrideDontWriteConstraints})
: _overriddenName = overriddenName;
/// Finds all type converters used in this tables.

View File

@ -26,7 +26,6 @@ final Set<String> starters = {
};
const String _methodNamed = 'named';
const String _methodPrimaryKey = 'primaryKey';
const String _methodReferences = 'references';
const String _methodAutoIncrement = 'autoIncrement';
const String _methodWithLength = 'withLength';
@ -74,7 +73,6 @@ class ColumnParser extends ParserBase {
Expression foundDefaultExpression;
Expression createdTypeConverter;
DartType typeConverterRuntime;
var wasDeclaredAsPrimaryKey = false;
var nullable = false;
final foundFeatures = <ColumnFeature>[];
@ -114,9 +112,6 @@ class ColumnParser extends ParserBase {
);
});
break;
case _methodPrimaryKey:
wasDeclaredAsPrimaryKey = true;
break;
case _methodReferences:
break;
case _methodWithLength:
@ -130,7 +125,6 @@ class ColumnParser extends ParserBase {
));
break;
case _methodAutoIncrement:
wasDeclaredAsPrimaryKey = true;
foundFeatures.add(AutoIncrement());
break;
case _methodNullable:
@ -195,7 +189,6 @@ class ColumnParser extends ParserBase {
dartGetterName: getter.name.name,
name: name,
overriddenJsonName: _readJsonKey(getterElement),
declaredAsPrimaryKey: wasDeclaredAsPrimaryKey,
customConstraints: foundCustomConstraint,
nullable: nullable,
features: foundFeatures,

View File

@ -75,7 +75,6 @@ class CreateTable {
nullable: column.type.nullable,
dartGetterName: dartName,
name: ColumnName.implicitly(sqlName),
declaredAsPrimaryKey: isPrimaryKey,
features: features,
customConstraints: constraintWriter.toString(),
defaultArgument: defaultValue,
@ -92,6 +91,14 @@ class CreateTable {
final constraints = table.tableConstraints.map((c) => c.span.text).toList();
for (var keyConstraint in table.tableConstraints.whereType<KeyClause>()) {
if (keyConstraint.isPrimaryKey) {
primaryKey.addAll(keyConstraint.indexedColumns
.map((r) => foundColumns[r.columnName])
.where((c) => c != null));
}
}
return SpecifiedTable(
fromClass: null,
columns: foundColumns.values.toList(),
@ -101,6 +108,8 @@ class CreateTable {
primaryKey: primaryKey,
overrideWithoutRowId: table.withoutRowId ? true : null,
overrideTableConstraints: constraints.isNotEmpty ? constraints : null,
// we take care of writing the primary key ourselves
overrideDontWriteConstraints: true,
);
}

View File

@ -264,7 +264,9 @@ class TableWriter {
void _overrideFieldsIfNeeded(StringBuffer buffer) {
if (table.overrideWithoutRowId != null) {
final value = table.overrideWithoutRowId ? 'true' : 'false';
buffer..write('@override\n')..write('final bool withoutRowId = $value;');
buffer
..write('@override\n')
..write('final bool withoutRowId = $value;\n');
}
if (table.overrideTableConstraints != null) {
@ -273,7 +275,14 @@ class TableWriter {
buffer
..write('@override\n')
..write('final List<String> customConstraints = const [$value];');
..write('final List<String> customConstraints = const [$value];\n');
}
if (table.overrideDontWriteConstraints != null) {
final value = table.overrideDontWriteConstraints ? 'true' : 'false';
buffer
..write('@override\n')
..write('final bool dontWriteConstraints = $value;\n');
}
}
}