docks_theme_api 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.babelrc +4 -0
- data/.editorconfig +8 -0
- data/.eslintrc +115 -0
- data/.gitignore +24 -0
- data/.rubocop.yml +20 -0
- data/.travis.yml +16 -0
- data/Gemfile +4 -0
- data/README.md +5 -0
- data/Rakefile +3 -0
- data/assets/images/icons.svg +63 -0
- data/assets/scripts/coffeescript/pattern_library_helpers.coffee +8 -0
- data/assets/scripts/javascript/pattern_library_helpers.js +11 -0
- data/assets/scripts/pattern_library.js +10380 -0
- data/assets/scripts/pattern_library_demo.js +0 -0
- data/assets/styles/less/pattern-library-helpers.less +103 -0
- data/assets/styles/pattern-library-demo.css +1882 -0
- data/assets/styles/pattern-library.css +1882 -0
- data/assets/styles/sass/pattern-library-helpers.sass +90 -0
- data/assets/styles/scss/pattern-library-helpers.scss +99 -0
- data/assets/styles/stylus/pattern-library-helpers.styl +90 -0
- data/assets/templates/erb/demo.erb +26 -0
- data/assets/templates/erb/layouts/demo.erb +17 -0
- data/assets/templates/erb/layouts/pattern.erb +76 -0
- data/assets/templates/erb/partials/sidebar.erb +124 -0
- data/assets/templates/erb/partials/symbols/class.erb +1 -0
- data/assets/templates/erb/partials/symbols/demo.erb +40 -0
- data/assets/templates/erb/partials/symbols/factory.erb +70 -0
- data/assets/templates/erb/partials/symbols/function.erb +103 -0
- data/assets/templates/erb/partials/symbols/mixin.erb +62 -0
- data/assets/templates/erb/partials/symbols/variable.erb +59 -0
- data/assets/templates/erb/pattern.erb +102 -0
- data/assets/templates/haml/demo.haml +14 -0
- data/assets/templates/haml/layouts/demo.haml +6 -0
- data/assets/templates/haml/layouts/pattern.haml +38 -0
- data/assets/templates/haml/partials/sidebar.haml +68 -0
- data/assets/templates/haml/partials/symbols/class.haml +1 -0
- data/assets/templates/haml/partials/symbols/demo.haml +23 -0
- data/assets/templates/haml/partials/symbols/factory.haml +38 -0
- data/assets/templates/haml/partials/symbols/function.haml +54 -0
- data/assets/templates/haml/partials/symbols/mixin.haml +31 -0
- data/assets/templates/haml/partials/symbols/variable.haml +22 -0
- data/assets/templates/haml/pattern.haml +54 -0
- data/assets/templates/slim/demo.slim +24 -0
- data/assets/templates/slim/layouts/demo.slim +5 -0
- data/assets/templates/slim/layouts/pattern.slim +48 -0
- data/assets/templates/slim/partials/sidebar.slim +112 -0
- data/assets/templates/slim/partials/symbols/class.slim +1 -0
- data/assets/templates/slim/partials/symbols/demo.slim +30 -0
- data/assets/templates/slim/partials/symbols/factory.slim +57 -0
- data/assets/templates/slim/partials/symbols/function.slim +81 -0
- data/assets/templates/slim/partials/symbols/mixin.slim +45 -0
- data/assets/templates/slim/partials/symbols/variable.slim +35 -0
- data/assets/templates/slim/pattern.slim +63 -0
- data/docks_config.rb +32 -0
- data/docks_theme_api.gemspec +37 -0
- data/gulpfile.js +88 -0
- data/karma.conf.js +6 -0
- data/lib/docks_theme_api/components/base_component.rb +99 -0
- data/lib/docks_theme_api/components/code_block_component.rb +10 -0
- data/lib/docks_theme_api/components/popover_component.rb +15 -0
- data/lib/docks_theme_api/components/table_component.rb +34 -0
- data/lib/docks_theme_api/components/tablist_component.rb +11 -0
- data/lib/docks_theme_api/components.rb +21 -0
- data/lib/docks_theme_api/helpers/ui_helper.rb +69 -0
- data/lib/docks_theme_api/theme.rb +21 -0
- data/lib/docks_theme_api.rb +1 -0
- data/package.json +60 -0
- data/source/behaviors/filterable/filterable.coffee +353 -0
- data/source/behaviors/filterable/filterable.js +0 -0
- data/source/behaviors/filterable/filterable.scss +34 -0
- data/source/behaviors/filterable/package.json +3 -0
- data/source/behaviors/index.js +0 -0
- data/source/components/avatar/avatar.erb +20 -0
- data/source/components/avatar/avatar.js +142 -0
- data/source/components/avatar/avatar.scss +200 -0
- data/source/components/avatar/avatar_container.erb +13 -0
- data/source/components/avatar/package.json +3 -0
- data/source/components/avatar/spec/avatar_spec.js +81 -0
- data/source/components/badge/badge.scss +158 -0
- data/source/components/button/button.scss +213 -0
- data/source/components/card/card.scss +32 -0
- data/source/components/code_block/code-block.scss +353 -0
- data/source/components/code_block/code_block.erb +95 -0
- data/source/components/code_block/code_block.js +444 -0
- data/source/components/code_block/package.json +3 -0
- data/source/components/code_block/spec/code_block_spec.js +10 -0
- data/source/components/demo/demo.js +244 -0
- data/source/components/demo/demo.scss +90 -0
- data/source/components/demo/package.json +3 -0
- data/source/components/exploded/exploded.erb +25 -0
- data/source/components/exploded/exploded.js +694 -0
- data/source/components/exploded/exploded.scss +166 -0
- data/source/components/exploded/package.json +3 -0
- data/source/components/field/field.js +24 -0
- data/source/components/field/field.scss +101 -0
- data/source/components/field/package.json +3 -0
- data/source/components/header/header.scss +33 -0
- data/source/components/iframe/iframe.erb +12 -0
- data/source/components/iframe/iframe.js +381 -0
- data/source/components/iframe/package.json +3 -0
- data/source/components/index.js +37 -0
- data/source/components/inline_group/inline-group.scss +14 -0
- data/source/components/internal_link/internal_link.js +49 -0
- data/source/components/internal_link/package.json +3 -0
- data/source/components/list/list.scss +230 -0
- data/source/components/modal/modal.coffee +84 -0
- data/source/components/modal/modal.erb +19 -0
- data/source/components/modal/modal.js +0 -0
- data/source/components/modal/modal.scss +57 -0
- data/source/components/modal/package.json +3 -0
- data/source/components/notice/notice.scss +48 -0
- data/source/components/popover/package.json +3 -0
- data/source/components/popover/popover.coffee +562 -0
- data/source/components/popover/popover.erb +21 -0
- data/source/components/popover/popover.js +0 -0
- data/source/components/popover/popover.scss +139 -0
- data/source/components/range/range.scss +78 -0
- data/source/components/resizable/package.json +3 -0
- data/source/components/resizable/resizable.erb +30 -0
- data/source/components/resizable/resizable.js +250 -0
- data/source/components/resizable/resizable.scss +245 -0
- data/source/components/resizable/size_buttons.js +249 -0
- data/source/components/scroll_container/package.json +3 -0
- data/source/components/scroll_container/scroll-container.scss +4 -0
- data/source/components/scroll_container/scroll_container.js +24 -0
- data/source/components/section/section.scss +99 -0
- data/source/components/select/package.json +3 -0
- data/source/components/select/select.erb +21 -0
- data/source/components/select/select.js +35 -0
- data/source/components/select/select.scss +163 -0
- data/source/components/table/package.json +3 -0
- data/source/components/table/table.erb +16 -0
- data/source/components/table/table.js +351 -0
- data/source/components/table/table.scss +236 -0
- data/source/components/tablist/package.json +3 -0
- data/source/components/tablist/tablist.erb +13 -0
- data/source/components/tablist/tablist.js +246 -0
- data/source/components/tablist/tablist.scss +191 -0
- data/source/components/tablist/tablist_panel.erb +14 -0
- data/source/components/tablist/tablist_tab.erb +20 -0
- data/source/components/toggle/package.json +3 -0
- data/source/components/toggle/toggle.erb +11 -0
- data/source/components/toggle/toggle.js +211 -0
- data/source/components/toggle/toggle_container.erb +30 -0
- data/source/components/vertical_spacer/vertical-spacer.scss +3 -0
- data/source/components/vertical_stack/vertical-stack.scss +19 -0
- data/source/components/xray/package.json +3 -0
- data/source/components/xray/xray.erb +50 -0
- data/source/components/xray/xray.js +123 -0
- data/source/components/xray/xray.scss +79 -0
- data/source/foundation/app/app.js +15 -0
- data/source/foundation/app/package.json +3 -0
- data/source/pattern-library-demo.scss +13 -0
- data/source/pattern-library.scss +13 -0
- data/source/pattern_library.js +8 -0
- data/source/pattern_library_demo.js +8 -0
- data/source/structures/index.js +11 -0
- data/source/structures/sidebar/package.json +3 -0
- data/source/structures/sidebar/sidebar.js +69 -0
- data/source/structures/sidebar/sidebar.scss +79 -0
- data/source/utilities/builder/builder.js +138 -0
- data/source/utilities/builder/package.json +3 -0
- data/source/utilities/client/client.js +7 -0
- data/source/utilities/client/package.json +3 -0
- data/source/utilities/colors/colors.scss +112 -0
- data/source/utilities/defaults/defaults.scss +38 -0
- data/source/utilities/dom_cache/dom_cache.js +24 -0
- data/source/utilities/dom_cache/package.json +3 -0
- data/source/utilities/events/events.js +25 -0
- data/source/utilities/events/package.json +3 -0
- data/source/utilities/font_sizes/font-sizes.scss +85 -0
- data/source/utilities/foundation/a11y.scss +10 -0
- data/source/utilities/foundation/base.scss +29 -0
- data/source/utilities/foundation/icon.scss +114 -0
- data/source/utilities/foundation/layout.scss +67 -0
- data/source/utilities/foundation/page.scss +39 -0
- data/source/utilities/foundation/type.scss +208 -0
- data/source/utilities/functions/functions.scss +127 -0
- data/source/utilities/keycodes/keycodes.js +23 -0
- data/source/utilities/keycodes/package.json +3 -0
- data/source/utilities/markup/markup.js +90 -0
- data/source/utilities/markup/package.json +3 -0
- data/source/utilities/media/media.scss +172 -0
- data/source/utilities/mixins/mixins.scss +89 -0
- data/source/utilities/naming_convention/naming_convention.js +3 -0
- data/source/utilities/naming_convention/package.json +3 -0
- data/source/utilities/numbers/numbers.js +14 -0
- data/source/utilities/numbers/package.json +3 -0
- data/source/utilities/painting/package.json +3 -0
- data/source/utilities/painting/painting.js +7 -0
- data/source/utilities/pattern/package.json +3 -0
- data/source/utilities/pattern/pattern.js +50 -0
- data/source/utilities/query_string/package.json +3 -0
- data/source/utilities/query_string/query_string.js +24 -0
- data/source/utilities/template/package.json +3 -0
- data/source/utilities/template/template.js +10 -0
- data/source/utilities/text_range/package.json +3 -0
- data/source/utilities/text_range/text_range.js +30 -0
- data/source/utilities/ui_events/package.json +3 -0
- data/source/utilities/ui_events/ui_events.js +85 -0
- data/source/utilities/variables/variables.scss +18 -0
- data/source/utilities/z_indexes/z-indexes.scss +88 -0
- data/source/vendor/array_includes.js +28 -0
- data/source/vendor/highlight.js +1142 -0
- data/source/vendor/index.js +1 -0
- data/source/vendor/matrix.js +399 -0
- data/source/vendor/query_string.js +66 -0
- data/spec/assets/.eslintrc +9 -0
- data/spec/assets/spec_fixture.js +33 -0
- data/spec/assets/spec_helper.js +19 -0
- data/spec/lib/components/base_component_spec.rb +156 -0
- data/spec/lib/components_spec.rb +30 -0
- data/spec/lib/helpers/ui_helper_spec.rb +62 -0
- data/spec/lib/theme_spec.rb +25 -0
- data/spec/spec_helper.rb +15 -0
- data/tasks/gulp/.eslintrc +6 -0
- data/tasks/gulp/browser_sync.js +8 -0
- data/tasks/gulp/code_quality/scripts.js +10 -0
- data/tasks/gulp/config/index.js +116 -0
- data/tasks/gulp/minify/scripts.js +13 -0
- data/tasks/gulp/minify/styles.js +13 -0
- data/tasks/gulp/pattern_library/index.js +5 -0
- data/tasks/gulp/pattern_library/scripts.js +10 -0
- data/tasks/gulp/pattern_library/styles.js +10 -0
- data/tasks/gulp/scripts.js +8 -0
- data/tasks/gulp/spec/scripts.js +11 -0
- data/tasks/gulp/styles.js +17 -0
- data/tasks/gulp/utilities/babel/relative_require.js +22 -0
- data/tasks/gulp/utilities/babel/spec_helper.js +20 -0
- data/tasks/gulp/utilities/browserify_bundler.js +22 -0
- data/tasks/gulp/utilities/handle_errors.js +13 -0
- data/tasks/gulp/watch.js +9 -0
- data/tasks/rake/rspec.rake +7 -0
- data/tasks/rake/rubocop.rake +8 -0
- data/tasks/rake/templates.rake +50 -0
- metadata +470 -0
@@ -0,0 +1,69 @@
|
|
1
|
+
const classes = {
|
2
|
+
base: "sidebar",
|
3
|
+
toggler: "sidebar__toggler"
|
4
|
+
};
|
5
|
+
|
6
|
+
const states = {
|
7
|
+
base: { active: `${classes.base}--is-active` }
|
8
|
+
};
|
9
|
+
|
10
|
+
var Sidebar, root, show, hide, toggle, check_for_sidebar_state_change;
|
11
|
+
|
12
|
+
//*
|
13
|
+
// Reveals the sidebar.
|
14
|
+
|
15
|
+
show = () => {
|
16
|
+
root.classList.add(states.base.active);
|
17
|
+
setTimeout(() => { document.addEventListener("click", check_for_sidebar_state_change); }, 0);
|
18
|
+
};
|
19
|
+
|
20
|
+
//*
|
21
|
+
// Hides the sidebar.
|
22
|
+
|
23
|
+
hide = () => {
|
24
|
+
document.removeEventListener("click", check_for_sidebar_state_change);
|
25
|
+
root.classList.remove(states.base.active);
|
26
|
+
};
|
27
|
+
|
28
|
+
//*
|
29
|
+
// Toggles the visibility of the sidebar.
|
30
|
+
|
31
|
+
toggle = () => {
|
32
|
+
return Sidebar.is_active ? hide() : show();
|
33
|
+
};
|
34
|
+
|
35
|
+
//*
|
36
|
+
// Captures all clicks when the sidebar is active and checks whether or not the
|
37
|
+
// sidebar should change its visibility. If the sidebar is clicked on, it should
|
38
|
+
// remain open — otherwise, it should close.
|
39
|
+
//
|
40
|
+
// @param {Object} event - The `click` event on the `document`.
|
41
|
+
// @private
|
42
|
+
|
43
|
+
check_for_sidebar_state_change = (event) => {
|
44
|
+
if(!$(event.target).closest(`.${classes.base}`).length) { hide(); }
|
45
|
+
};
|
46
|
+
|
47
|
+
//*
|
48
|
+
// The global sidebar object. Use this method for manually updating the state of
|
49
|
+
// the sidebar; however, note that click events on the toggler and when the
|
50
|
+
// sidebar is open are handled automatically by the component itself.
|
51
|
+
|
52
|
+
Sidebar = {
|
53
|
+
show,
|
54
|
+
hide,
|
55
|
+
toggle,
|
56
|
+
|
57
|
+
get is_active() {
|
58
|
+
return root.classList.contains(states.base.active);
|
59
|
+
},
|
60
|
+
|
61
|
+
init() {
|
62
|
+
root = document.querySelector(`.${classes.base}`);
|
63
|
+
if(!root) { return; }
|
64
|
+
|
65
|
+
document.querySelector(`.${classes.toggler}`).addEventListener("click", toggle);
|
66
|
+
}
|
67
|
+
};
|
68
|
+
|
69
|
+
export default Sidebar;
|
@@ -0,0 +1,79 @@
|
|
1
|
+
// ___ _____ ___ ___ ___
|
2
|
+
// / /\ ___ / /::\ / /\ _____ / /\ / /\
|
3
|
+
// / /:/_ / /\ / /:/\:\ / /:/_ / /::\ / /::\ / /::\
|
4
|
+
// / /:/ /\ / /:/ / /:/ \:\ / /:/ /\ / /:/\:\ / /:/\:\ / /:/\:\
|
5
|
+
// / /:/ /::\/__/::\ /__/:/ \__\:|/ /:/ /:/_ / /:/~/::\ / /:/~/::\ / /:/~/:/
|
6
|
+
// /__/:/ /:/\:\__\/\:\_\ \:\ / /:/__/:/ /:/ /\/__/:/ /:/\:/__/:/ /:/\:\/__/:/ /:/___
|
7
|
+
// \ \:\/:/~/:/ \ \:\/\ \:\ /:/\ \:\/:/ /:/\ \:\/:/~/:| \:\/:/__\/\ \:\/:::::/
|
8
|
+
// \ \::/ /:/ \__\::/\ \:\/:/ \ \::/ /:/ \ \::/ /:/ \ \::/ \ \::/~~~~
|
9
|
+
// \__\/ /:/ /__/:/ \ \::/ \ \:\/:/ \ \:\/:/ \ \:\ \ \:\
|
10
|
+
// /__/:/ \__\/ \__\/ \ \::/ \ \::/ \ \:\ \ \:\
|
11
|
+
// \__\/ \__\/ \__\/ \__\/ \__\/
|
12
|
+
|
13
|
+
//*
|
14
|
+
// @pattern Sidebar
|
15
|
+
// @group Partials
|
16
|
+
//
|
17
|
+
// The main sidebar for the page. This sidebar is activated by a toggle
|
18
|
+
// (`sidebar__toggler`) and slides over the main content (without moving the
|
19
|
+
// main content).
|
20
|
+
//
|
21
|
+
// @since 1.0.0
|
22
|
+
|
23
|
+
//*
|
24
|
+
// The main piece of the sidebar. This provides the visual backing of the
|
25
|
+
// sidebar and manages the reveal/ hide transition.
|
26
|
+
|
27
|
+
.sidebar {
|
28
|
+
// position
|
29
|
+
position: absolute;
|
30
|
+
left: 0; top: 0;
|
31
|
+
-webkit-transform: translate3d(-100%, 0, 0);
|
32
|
+
transform: translate3d(-100%, 0, 0);
|
33
|
+
transition: transform 0.2s ease;
|
34
|
+
max-width: 15rem;
|
35
|
+
|
36
|
+
// box model
|
37
|
+
display: flex;
|
38
|
+
height: 100vh;
|
39
|
+
|
40
|
+
// backdrop
|
41
|
+
background-color: ui-color(white);
|
42
|
+
@include default(box-shadow);
|
43
|
+
|
44
|
+
@include after(40rem) {
|
45
|
+
position: static;
|
46
|
+
transform: translate3d(0, 0, 0);
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
//*
|
51
|
+
// The state that is added by the JavaScript component when the sidebar is
|
52
|
+
// visible.
|
53
|
+
|
54
|
+
.sidebar--is-active {
|
55
|
+
transform: translate3d(0, 0, 0);
|
56
|
+
}
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
//*
|
61
|
+
// The container for the item that should activate the sidebar. The JavaScript
|
62
|
+
// component will look for any instances of this class and will attach `click`
|
63
|
+
// handlers that that toggle the sidebar's visibility.
|
64
|
+
|
65
|
+
.sidebar__toggler {
|
66
|
+
background: transparent;
|
67
|
+
padding: 0;
|
68
|
+
margin: 0;
|
69
|
+
appearance: none;
|
70
|
+
border: none;
|
71
|
+
|
72
|
+
&:focus {
|
73
|
+
outline: none;
|
74
|
+
}
|
75
|
+
|
76
|
+
// @include after(40rem) {
|
77
|
+
// display: none;
|
78
|
+
// }
|
79
|
+
}
|
@@ -0,0 +1,138 @@
|
|
1
|
+
import Cache from "~utilities/dom_cache";
|
2
|
+
|
3
|
+
//*
|
4
|
+
// @pattern Builder
|
5
|
+
// @group Helper
|
6
|
+
//
|
7
|
+
// A utility for building all instances of factories. This manages the finding
|
8
|
+
// and initialization of instances of a factory, cacheing, adding cache
|
9
|
+
// retrieval methods, and more.
|
10
|
+
|
11
|
+
var Builder, add_retrieval_methods;
|
12
|
+
|
13
|
+
//*
|
14
|
+
// Adds static methods to `Factory` that allow it to retrieve cached instances
|
15
|
+
// from nodes.
|
16
|
+
//
|
17
|
+
// @private
|
18
|
+
//
|
19
|
+
// @param {Function} Factory - The factory function to add methods to.
|
20
|
+
//
|
21
|
+
// @param {Object} [options = {}]
|
22
|
+
//
|
23
|
+
// @param {String} [options.name] - The name for this Factory. This will
|
24
|
+
// be used as the root class name if `options.selector` is not provided.
|
25
|
+
//
|
26
|
+
// @param {String} [options.selector] - The selector to use to find nodes
|
27
|
+
// to call the factory on.
|
28
|
+
|
29
|
+
add_retrieval_methods = (Factory, options = {}) => {
|
30
|
+
if(!Factory.for) {
|
31
|
+
Factory.for = (node) => {
|
32
|
+
return Cache($(node).closest(options.selector)[0]).get(options.name);
|
33
|
+
};
|
34
|
+
}
|
35
|
+
|
36
|
+
if(!Factory.within) {
|
37
|
+
Factory.within = (node) => {
|
38
|
+
var results = [], api,
|
39
|
+
nodes = Array.from(node.querySelectorAll(options.selector));
|
40
|
+
|
41
|
+
for(node of nodes) {
|
42
|
+
api = Factory.for(node);
|
43
|
+
if(api) { results.push(api); }
|
44
|
+
}
|
45
|
+
|
46
|
+
return results;
|
47
|
+
};
|
48
|
+
}
|
49
|
+
};
|
50
|
+
|
51
|
+
//*
|
52
|
+
// @object
|
53
|
+
|
54
|
+
Builder = {
|
55
|
+
|
56
|
+
//*
|
57
|
+
// Creates all required instances of the passed factory.
|
58
|
+
//
|
59
|
+
// @method
|
60
|
+
//
|
61
|
+
// @param {Function} Factory - The factory function to use.
|
62
|
+
//
|
63
|
+
// @param {Object} [options = {}]
|
64
|
+
//
|
65
|
+
// @param {String} [options.name] - The name for this Factory. This will
|
66
|
+
// be used to set up cacheing if required, and will be used as the root
|
67
|
+
// class name if `options.selector` is not provided.
|
68
|
+
//
|
69
|
+
// @param {String} [options.selector] - The selector to use to find nodes
|
70
|
+
// to call the factory on.
|
71
|
+
//
|
72
|
+
// @param {Boolean} [options.cache = false] - Whether or not to cache the
|
73
|
+
// return result of the factory on the node.
|
74
|
+
//
|
75
|
+
// @param {Function} [options.filter] - A function that determines whether
|
76
|
+
// or not a given node should be used as a root for the `factory`. This
|
77
|
+
// function is passed a single argument, `node`, which is the node to test.
|
78
|
+
|
79
|
+
build(Factory, options = {}) {
|
80
|
+
var node, nodes, api;
|
81
|
+
|
82
|
+
nodes = options.selector ?
|
83
|
+
document.querySelectorAll(options.selector) :
|
84
|
+
document.getElementsByClassName(options.name);
|
85
|
+
|
86
|
+
options.selector = options.selector || `.${options.name}`;
|
87
|
+
|
88
|
+
if(options.cache) {
|
89
|
+
add_retrieval_methods(Factory, options);
|
90
|
+
}
|
91
|
+
|
92
|
+
for(node of Array.from(nodes)) {
|
93
|
+
if(options.filter && !options.filter(node)) { continue; }
|
94
|
+
|
95
|
+
api = Factory(node);
|
96
|
+
if(options.cache) { Cache(node).set(options.name, api); }
|
97
|
+
}
|
98
|
+
},
|
99
|
+
|
100
|
+
//*
|
101
|
+
// Builds the passed factory and caches the result. This is equivalent to:
|
102
|
+
//
|
103
|
+
// ```
|
104
|
+
// Builder.build(Factory, { cache: true });
|
105
|
+
// ```
|
106
|
+
//
|
107
|
+
// See [`Builder.build`](@link) for more details on `options` argument.
|
108
|
+
//
|
109
|
+
// @param {Function} Factory - The factory function to use.
|
110
|
+
// @param {Object} [options = {}]
|
111
|
+
//
|
112
|
+
// @method
|
113
|
+
|
114
|
+
build_and_cache(Factory, options = {}) {
|
115
|
+
options.cache = true;
|
116
|
+
return this.build(Factory, options);
|
117
|
+
},
|
118
|
+
|
119
|
+
//*
|
120
|
+
// Builds the passed factory but, before doing so, ensures that each node
|
121
|
+
// has not been used as an argument for this factory.
|
122
|
+
//
|
123
|
+
// See [`Builder.build`](@link) for more details on `options` argument.
|
124
|
+
//
|
125
|
+
// @param {Function} Factory - The factory function to use.
|
126
|
+
// @param {Object} [options = {}]
|
127
|
+
//
|
128
|
+
// @method
|
129
|
+
|
130
|
+
initialize_once(Factory, options = {}) {
|
131
|
+
return () => {
|
132
|
+
options.filter = (node) => { return !Factory.for(node); };
|
133
|
+
Builder.build_and_cache(Factory, options);
|
134
|
+
};
|
135
|
+
}
|
136
|
+
};
|
137
|
+
|
138
|
+
export default Builder;
|
@@ -0,0 +1,112 @@
|
|
1
|
+
//*
|
2
|
+
// @pattern Colors
|
3
|
+
// @group Helper
|
4
|
+
//
|
5
|
+
// This stylesheet provides a centralized location to manage colors. Colors
|
6
|
+
// should **never** be declared in CSS directly; instead, add the color to the
|
7
|
+
// `$COLORS` map (following the "color-modifier" naming convention) and
|
8
|
+
// then include it as required using the `color()` function described below.
|
9
|
+
//
|
10
|
+
// The color component also provides some utility methods to darken (`shade()`)
|
11
|
+
// and lighten (`tint()`) colors — use these only for one-offs that are deemed
|
12
|
+
// absolutely necessary. For variations that are used in multiple places, add
|
13
|
+
// a new variation to the `$COLORS` map.
|
14
|
+
|
15
|
+
|
16
|
+
$UI_COLORS: (
|
17
|
+
white: ( base: rgb(255, 255, 255) ),
|
18
|
+
black: ( base: rgb(30, 30, 31) ),
|
19
|
+
|
20
|
+
gray: (
|
21
|
+
light: rgb(242, 242, 243),
|
22
|
+
base: rgb(227, 228, 230),
|
23
|
+
dark: rgb(209, 211, 215),
|
24
|
+
darker: rgb(156, 157, 165),
|
25
|
+
darkest: rgb(110, 111, 122)
|
26
|
+
),
|
27
|
+
|
28
|
+
yellow: (
|
29
|
+
base: rgb(253, 247, 175),
|
30
|
+
dark: rgb(133, 126, 50)
|
31
|
+
),
|
32
|
+
|
33
|
+
blue: (
|
34
|
+
base: rgb(183, 214, 246),
|
35
|
+
dark: rgb(140, 194, 251),
|
36
|
+
darker: rgb(98, 121, 144)
|
37
|
+
)
|
38
|
+
);
|
39
|
+
|
40
|
+
@function ui-color($color, $shade: base) {
|
41
|
+
@return map-get(map-get($UI_COLORS, $color), $shade);
|
42
|
+
}
|
43
|
+
|
44
|
+
|
45
|
+
$COLORS: (
|
46
|
+
white: rgb(255, 255, 255),
|
47
|
+
black: rgb(30, 30, 31),
|
48
|
+
|
49
|
+
blue-light: rgb(135, 194, 235),
|
50
|
+
blue: rgb(65, 150, 223),
|
51
|
+
blue-dark: rgb(40, 134, 214),
|
52
|
+
blue-darker: rgb(26, 92, 171),
|
53
|
+
|
54
|
+
yellow: rgb(252, 246, 161),
|
55
|
+
yellow-dark: rgb(139, 134, 72),
|
56
|
+
|
57
|
+
slate-light: rgb(55, 57, 60),
|
58
|
+
slate: rgb(51, 54, 58),
|
59
|
+
|
60
|
+
gray-lighter: rgb(248, 248, 248),
|
61
|
+
gray-light: rgb(241, 241, 241),
|
62
|
+
gray: rgb(207, 207, 207),
|
63
|
+
gray-dark: rgb(177, 177, 177),
|
64
|
+
gray-darker: rgb(74, 74, 74)
|
65
|
+
);
|
66
|
+
|
67
|
+
|
68
|
+
//*
|
69
|
+
// Returns the color associated with the passed identifier.
|
70
|
+
//
|
71
|
+
// @author Chris Sauve (github: lemonmade)
|
72
|
+
//
|
73
|
+
// @param {String} $color - The color (or other identifier that
|
74
|
+
// maps to a color) to search for in the
|
75
|
+
// global `$COLORS` map.
|
76
|
+
//
|
77
|
+
// @example scss
|
78
|
+
// .foo {
|
79
|
+
// background: color(red); // => background: rgb(245, 79, 84);
|
80
|
+
// }
|
81
|
+
//
|
82
|
+
// @returns {Color}
|
83
|
+
|
84
|
+
@function color($color) {
|
85
|
+
@return map-get($COLORS, $color);
|
86
|
+
}
|
87
|
+
|
88
|
+
|
89
|
+
//*
|
90
|
+
// Slightly lighten a color.
|
91
|
+
//
|
92
|
+
// @param {Color} $color - The color to tint.
|
93
|
+
// @param {Number} $percentage - Percentage of `$color` in the returned color.
|
94
|
+
//
|
95
|
+
// @returns {Color}
|
96
|
+
|
97
|
+
@function tint($color, $percentage) {
|
98
|
+
@return mix($color, color(white), $percentage);
|
99
|
+
}
|
100
|
+
|
101
|
+
|
102
|
+
//*
|
103
|
+
// Slightly darken a color.
|
104
|
+
//
|
105
|
+
// @param {Color} $color - The color to shade.
|
106
|
+
// @param {Number} $percentage - Percentage of `$color` in the returned color.
|
107
|
+
//
|
108
|
+
// @returns {Color}
|
109
|
+
|
110
|
+
@function shade($color, $percentage) {
|
111
|
+
@return mix($color, color(black), $percentage);
|
112
|
+
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
// ___ ___ ___ _ _ _ _ _____ ___
|
2
|
+
// | \| __| __/_\| | | | ||_ _/ __|
|
3
|
+
// | |) | _|| _/ _ \ |_| | |__| | \__ \
|
4
|
+
// |___/|___|_/_/ \_\___/|____|_| |___/
|
5
|
+
//
|
6
|
+
// =========================================================================================
|
7
|
+
// =========================================================================================
|
8
|
+
//
|
9
|
+
// This stylesheet decalres default values for common visual elements. Use this
|
10
|
+
// map in place of declaring variables, which could be slightly harder to remember
|
11
|
+
// the name of and present more of a risk of naming conflicts. To add a default,
|
12
|
+
// add a descriptive key name to the map that references a map that has an `ios`
|
13
|
+
// and an `android` key. Then, retrieve the value using `default($property, $platform)`,
|
14
|
+
// where platform defaults to iOS. If the property you are adding is also a valid
|
15
|
+
// CSS property (i.e., default borders or border radii), you can directly include
|
16
|
+
// that declaration in CSS using the mixin version of `default()`.
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
$DEFAULTS: (
|
21
|
+
spacing: 1rem,
|
22
|
+
border-radius: 4px,
|
23
|
+
line-height: 1.3,
|
24
|
+
control-size: rem(34),
|
25
|
+
control-size--large: rem(42),
|
26
|
+
control-padding: 0.75rem,
|
27
|
+
box-shadow: 0 0 4px rgba(color(black), 0.3)
|
28
|
+
);
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
@function default($property) {
|
33
|
+
@return map-get($DEFAULTS, $property);
|
34
|
+
}
|
35
|
+
|
36
|
+
@mixin default($property) {
|
37
|
+
#{$property}: default($property);
|
38
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
// ___ ___ ___ ___ ___
|
2
|
+
// / /\ / /\ / /\ /__/\ / /\
|
3
|
+
// / /:/ / /::\ / /:/ \ \:\ / /:/_
|
4
|
+
// / /:/ / /:/\:\ / /:/ \__\:\ / /:/ /\
|
5
|
+
// / /:/ ___ / /:/~/::\ / /:/ ___ ___ / /::\ / /:/ /:/_
|
6
|
+
// /__/:/ / /\/__/:/ /:/\:\/__/:/ / /\/__/\ /:/\:\/__/:/ /:/ /\
|
7
|
+
// \ \:\ / /:/\ \:\/:/__\/\ \:\ / /:/\ \:\/:/__\/\ \:\/:/ /:/
|
8
|
+
// \ \:\ /:/ \ \::/ \ \:\ /:/ \ \::/ \ \::/ /:/
|
9
|
+
// \ \:\/:/ \ \:\ \ \:\/:/ \ \:\ \ \:\/:/
|
10
|
+
// \ \::/ \ \:\ \ \::/ \ \:\ \ \::/
|
11
|
+
// \__\/ \__\/ \__\/ \__\/ \__\/
|
12
|
+
|
13
|
+
var Cache;
|
14
|
+
|
15
|
+
Cache = (node) => {
|
16
|
+
var $node = $(node);
|
17
|
+
|
18
|
+
return {
|
19
|
+
get(key) { return $node.data(key); },
|
20
|
+
set(key, value) { return $node.data(key, value); }
|
21
|
+
};
|
22
|
+
};
|
23
|
+
|
24
|
+
export default Cache;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
// ___ ___ ___ ___
|
2
|
+
// / /\ ___ / /\ /__/\ ___ / /\
|
3
|
+
// / /:/_ /__/\ / /:/_ \ \:\ / /\ / /:/_
|
4
|
+
// / /:/ /\ \ \:\ / /:/ /\ \ \:\ / /:/ / /:/ /\
|
5
|
+
// / /:/ /:/_ \ \:\ / /:/ /:/_ _____\__\:\ / /:/ / /:/ /::\
|
6
|
+
// /__/:/ /:/ /\ ___ \__\:\/__/:/ /:/ /\/__/::::::::\ / /::\ /__/:/ /:/\:\
|
7
|
+
// \ \:\/:/ /://__/\ | |:|\ \:\/:/ /:/\ \:\~~\~~\//__/:/\:\\ \:\/:/~/:/
|
8
|
+
// \ \::/ /:/ \ \:\| |:| \ \::/ /:/ \ \:\ ~~~ \__\/ \:\\ \::/ /:/
|
9
|
+
// \ \:\/:/ \ \:\__|:| \ \:\/:/ \ \:\ \ \:\\__\/ /:/
|
10
|
+
// \ \::/ \__\::::/ \ \::/ \ \:\ \__\/ /__/:/
|
11
|
+
// \__\/ ~~~~ \__\/ \__\/ \__\/
|
12
|
+
|
13
|
+
var Events = {
|
14
|
+
register(...events) {
|
15
|
+
var event;
|
16
|
+
|
17
|
+
for(event of events) {
|
18
|
+
this.types[event] = event;
|
19
|
+
}
|
20
|
+
},
|
21
|
+
|
22
|
+
types: {}
|
23
|
+
};
|
24
|
+
|
25
|
+
export default Events;
|
@@ -0,0 +1,85 @@
|
|
1
|
+
// ___ ___ ___ ___ ___ ___
|
2
|
+
// / /\ / /\ /__/\ ___ / /\ ___ / /\ / /\
|
3
|
+
// / /:/_ / /::\ \ \:\ / /\ / /:/_ / /\ / /::| / /:/_
|
4
|
+
// / /:/ /\/ /:/\:\ \ \:\ / /:/ / /:/ /\ / /:/ / /:/:| / /:/ /\
|
5
|
+
// / /:/ /:/ /:/ \:\ _____\__\:\ / /:/ / /:/ /::\/__/::\ / /:/|:|__ / /:/ /:/_
|
6
|
+
// /__/:/ /:/__/:/ \__\:\/__/::::::::\/ /::\ /__/:/ /:/\:\__\/\:\__/__/:/ |:| /\/__/:/ /:/ /\
|
7
|
+
// \ \:\/:/\ \:\ / /:/\ \:\~~\~~\/__/:/\:\ \ \:\/:/~/:/ \ \:\/\__\/ |:|/:/\ \:\/:/ /:/
|
8
|
+
// \ \::/ \ \:\ /:/ \ \:\ ~~~\__\/ \:\ \ \::/ /:/ \__\::/ | |:/:/ \ \::/ /:/
|
9
|
+
// \ \:\ \ \:\/:/ \ \:\ \ \:\ \__\/ /:/ /__/:/ | |::/ \ \:\/:/
|
10
|
+
// \ \:\ \ \::/ \ \:\ \__\/ /__/:/ \__\/ | |:/ \ \::/
|
11
|
+
// \__\/ \__\/ \__\/ \__\/ |__|/ \__\/
|
12
|
+
//
|
13
|
+
//*
|
14
|
+
// @pattern Font Sizes
|
15
|
+
// @group Helper
|
16
|
+
//
|
17
|
+
// The stylesheet exists as a single place to manage all font sizes. To use
|
18
|
+
// a font size in your stylesheet, follow this procedure:
|
19
|
+
//
|
20
|
+
// 1. Add a well-named entry to the `$FONT-SIZES` map with the value set to
|
21
|
+
// the font size for that element.
|
22
|
+
//
|
23
|
+
// 2. If you wish to include a `font-size` declaration in your stylesheet,
|
24
|
+
// `@include font-size()`, passing it the name of the component to retrieve
|
25
|
+
// the font-size for.
|
26
|
+
//
|
27
|
+
// 3. Retrieving the actual font-size dimension (for example, to be used in a
|
28
|
+
// calculation to determine necessary padding) should be done by passing the
|
29
|
+
// same argument discussed above to the `font-size` *function*.
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
$FONT_SIZES: (
|
34
|
+
heading-1: rem(36),
|
35
|
+
heading-2: rem(30),
|
36
|
+
heading-3: rem(24),
|
37
|
+
heading-4: rem(14),
|
38
|
+
heading-5: rem(20),
|
39
|
+
label: rem(16),
|
40
|
+
paragraph: rem(20),
|
41
|
+
paragraph-small: rem(18),
|
42
|
+
avatar: rem(20),
|
43
|
+
badge: 0.75em,
|
44
|
+
badge--standalone: rem(16),
|
45
|
+
code-block: rem(16),
|
46
|
+
code-block--condensed: rem(14),
|
47
|
+
list-heading: rem(20),
|
48
|
+
select: rem(16),
|
49
|
+
tablist: rem(16),
|
50
|
+
tablist--large: rem(24),
|
51
|
+
control: rem(18)
|
52
|
+
);
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
//*
|
57
|
+
// Retrives the font-size for an element declared in the global
|
58
|
+
// `$FONT_SIZES` map. This will not actually add a CSS rule — if you
|
59
|
+
// would like the actual `font-size` rule to be printed, use the
|
60
|
+
// `@mixin` version. Use this function when you want to retrive the font
|
61
|
+
// size for use in other calculations.
|
62
|
+
//
|
63
|
+
// @param {String} $element - The element whose font-size should be retrieved.
|
64
|
+
// @returns {Number}
|
65
|
+
|
66
|
+
@function font-size($element) {
|
67
|
+
@return map-get($FONT-SIZES, $element);
|
68
|
+
}
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
//*
|
73
|
+
// Retrives the font-size for an element declared in the global
|
74
|
+
// `$FONT_SIZES` map **and** prints the `font-size` rule.
|
75
|
+
//
|
76
|
+
// @param {String} $element - The element whose font-size should be retrieved.
|
77
|
+
//
|
78
|
+
// @example
|
79
|
+
// .type--heading-1 {
|
80
|
+
// @include font-size(heading-1); // => font-size: 2rem;
|
81
|
+
// }
|
82
|
+
|
83
|
+
@mixin font-size($element) {
|
84
|
+
font-size: font-size($element);
|
85
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
// ___ ___ ___
|
2
|
+
// _____ / /\ / /\ / /\
|
3
|
+
// / /::\ / /::\ / /:/_ / /:/_
|
4
|
+
// / /:/\:\ / /:/\:\ / /:/ /\ / /:/ /\
|
5
|
+
// / /:/~/::\ / /:/~/::\ / /:/ /::\ / /:/ /:/_
|
6
|
+
// /__/:/ /:/\:/__/:/ /:/\:\/__/:/ /:/\:\/__/:/ /:/ /\
|
7
|
+
// \ \:\/:/~/:| \:\/:/__\/\ \:\/:/~/:/\ \:\/:/ /:/
|
8
|
+
// \ \::/ /:/ \ \::/ \ \::/ /:/ \ \::/ /:/
|
9
|
+
// \ \:\/:/ \ \:\ \__\/ /:/ \ \:\/:/
|
10
|
+
// \ \::/ \ \:\ /__/:/ \ \::/
|
11
|
+
// \__\/ \__\/ \__\/ \__\/
|
12
|
+
|
13
|
+
html { box-sizing: border-box; }
|
14
|
+
|
15
|
+
*,
|
16
|
+
*:before,
|
17
|
+
*:after { box-sizing: inherit; }
|
18
|
+
|
19
|
+
body {
|
20
|
+
margin: 0;
|
21
|
+
padding: 0;
|
22
|
+
background-color: color(white);
|
23
|
+
min-height: 100vh;
|
24
|
+
}
|
25
|
+
|
26
|
+
table {
|
27
|
+
border-collapse: collapse;
|
28
|
+
border-spacing: 0;
|
29
|
+
}
|