docks_theme_api 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,230 @@
|
|
|
1
|
+
// ___
|
|
2
|
+
// ___ / /\ ___
|
|
3
|
+
// / /\ / /:/_ / /\
|
|
4
|
+
// ___ ___ / /:/ / /:/ /\ / /:/
|
|
5
|
+
// /__/\ / /\/__/::\ / /:/ /::\ / /:/
|
|
6
|
+
// \ \:\ / /:/\__\/\:\__/__/:/ /:/\:\/ /::\
|
|
7
|
+
// \ \:\ /:/ \ \:\/\ \:\/:/~/:/__/:/\:\
|
|
8
|
+
// \ \:\/:/ \__\::/\ \::/ /:/\__\/ \:\
|
|
9
|
+
// \ \::/ /__/:/ \__\/ /:/ \ \:\
|
|
10
|
+
// \__\/ \__\/ /__/:/ \__\/
|
|
11
|
+
// \__\/
|
|
12
|
+
|
|
13
|
+
//*
|
|
14
|
+
// @pattern List
|
|
15
|
+
//
|
|
16
|
+
// A list allows you to present a set of selectable items vertically. These
|
|
17
|
+
// lists can be be separated into any number of sublists, and two levels of
|
|
18
|
+
// subheadings are available (so, you can have a sublist within a sublist).
|
|
19
|
+
//
|
|
20
|
+
// The sublists can optionally allow a subheading to toggle the visibility of
|
|
21
|
+
// the associated sublist. It also supports the ability to filter the contents
|
|
22
|
+
// of a list to only items matching a given string, hiding subheadings as
|
|
23
|
+
// necessary.
|
|
24
|
+
//
|
|
25
|
+
// @since 1.0.0
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
//*
|
|
30
|
+
// The core container for a list. List items can go directly in this container
|
|
31
|
+
// or, if you want to provide toggle-able or filter-able sublists, within a
|
|
32
|
+
// sublist.
|
|
33
|
+
|
|
34
|
+
.list {
|
|
35
|
+
padding: 0;
|
|
36
|
+
margin: default(spacing) 0 double(default(spacing));
|
|
37
|
+
list-style: none;
|
|
38
|
+
|
|
39
|
+
.type--heading {
|
|
40
|
+
padding-left: default(spacing);
|
|
41
|
+
padding-right: default(spacing);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.popover & {
|
|
45
|
+
margin-bottom: default(spacing);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
//*
|
|
50
|
+
// An individual item within a list. These items have hover, focus, and active
|
|
51
|
+
// states so that it is clear what item is actionable/ being actioned.
|
|
52
|
+
|
|
53
|
+
.list__item {
|
|
54
|
+
// box model
|
|
55
|
+
display: block;
|
|
56
|
+
padding: quarter(default(spacing)) default(spacing);
|
|
57
|
+
|
|
58
|
+
// backdrop
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
|
|
61
|
+
// type
|
|
62
|
+
text-decoration: none;
|
|
63
|
+
color: ui-color(gray, darkest);
|
|
64
|
+
white-space: nowrap;
|
|
65
|
+
text-overflow: ellipsis;
|
|
66
|
+
overflow: hidden;
|
|
67
|
+
|
|
68
|
+
&:hover,
|
|
69
|
+
&:focus {
|
|
70
|
+
outline: none;
|
|
71
|
+
background: ui-color(gray, light);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&:active {
|
|
75
|
+
background-color: ui-color(blue);
|
|
76
|
+
color: ui-color(blue, darker);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
//*
|
|
81
|
+
// An item that is currently active For example, in the sidebar, this class is
|
|
82
|
+
// used for the item representing the currently-active pattern.
|
|
83
|
+
|
|
84
|
+
.list__item--is-active {
|
|
85
|
+
&,
|
|
86
|
+
&:hover,
|
|
87
|
+
&:focus {
|
|
88
|
+
background-color: ui-color(blue);
|
|
89
|
+
color: ui-color(blue, darker);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
//*
|
|
94
|
+
// A list item that is indented on the left to indicate that it is related to
|
|
95
|
+
// the closest, non-indented item above it.
|
|
96
|
+
|
|
97
|
+
.list__item--indented {
|
|
98
|
+
padding-left: calc(#{default(spacing)} + 2ch);
|
|
99
|
+
position: relative;
|
|
100
|
+
|
|
101
|
+
&:before {
|
|
102
|
+
content: "";
|
|
103
|
+
display: block;
|
|
104
|
+
position: absolute;
|
|
105
|
+
left: calc(#{default(spacing)} + 1ch);
|
|
106
|
+
top: 0;
|
|
107
|
+
height: 100%;
|
|
108
|
+
width: 2px;
|
|
109
|
+
background: rgba(ui-color(black), 0.07);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&:last-child:before {
|
|
113
|
+
height: 85%;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.list__item:not(.list__item--indented) + &:before {
|
|
117
|
+
top: 15%;
|
|
118
|
+
height: 85%;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
//*
|
|
123
|
+
// A subset of items that have their own hading to distinguish them. This
|
|
124
|
+
// subcomponent can contain any number of items and/ or other sublists. This
|
|
125
|
+
// grouping also allows the [`Filterable`](@link filterable) component to
|
|
126
|
+
// accurately hide subsets of the list, including headings within a group
|
|
127
|
+
// where all items are hidden.
|
|
128
|
+
|
|
129
|
+
.list__group {}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
//*
|
|
134
|
+
// A horizontal list of links separated by slashes.
|
|
135
|
+
|
|
136
|
+
.link-list {
|
|
137
|
+
padding: 0;
|
|
138
|
+
margin: 0;
|
|
139
|
+
list-style: none;
|
|
140
|
+
display: flex;
|
|
141
|
+
flex-wrap: wrap;
|
|
142
|
+
|
|
143
|
+
> li {
|
|
144
|
+
position: relative;
|
|
145
|
+
flex: 0 0 auto;
|
|
146
|
+
|
|
147
|
+
&:after {
|
|
148
|
+
$link-list__item--separator-height: 80%;
|
|
149
|
+
|
|
150
|
+
content: "";
|
|
151
|
+
|
|
152
|
+
// position
|
|
153
|
+
position: absolute;
|
|
154
|
+
top: half(100% - $link-list__item--separator-height);
|
|
155
|
+
right: -1px;
|
|
156
|
+
transform: rotate(15deg);
|
|
157
|
+
|
|
158
|
+
// box model
|
|
159
|
+
display: block;
|
|
160
|
+
height: $link-list__item--separator-height;
|
|
161
|
+
|
|
162
|
+
// backdrop
|
|
163
|
+
border-right: 2px solid rgba(ui-color(gray, darkest), 0.1);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
&:last-child:after {
|
|
167
|
+
display: none;
|
|
168
|
+
margin-right: 0;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
//*
|
|
174
|
+
// An individual list within a link list. This class should go on the actual
|
|
175
|
+
// anchor (or `button`, if there is no reasonable `href`) element so that
|
|
176
|
+
// there is as large a hit target as possible.
|
|
177
|
+
//
|
|
178
|
+
// Each item (except for the last one) is given a small separator so that it is
|
|
179
|
+
// clear where the hit areas end. This is placed on the containing `li` since
|
|
180
|
+
// the `link-list__item` can be a `button`.
|
|
181
|
+
//
|
|
182
|
+
// In the dark theme, the colors for each list item invert.
|
|
183
|
+
|
|
184
|
+
.link-list__item {
|
|
185
|
+
// position
|
|
186
|
+
position: relative;
|
|
187
|
+
|
|
188
|
+
// box model
|
|
189
|
+
display: block;
|
|
190
|
+
cursor: pointer;
|
|
191
|
+
padding: quarter(default(spacing)) half(default(spacing));
|
|
192
|
+
|
|
193
|
+
// backdrop
|
|
194
|
+
@include remove-browser-styling;
|
|
195
|
+
background: none;
|
|
196
|
+
border: none;
|
|
197
|
+
opacity: 0.6;
|
|
198
|
+
|
|
199
|
+
// type
|
|
200
|
+
font-size: 1em;
|
|
201
|
+
line-height: 1;
|
|
202
|
+
color: ui-color(gray, darker);
|
|
203
|
+
transition: opacity 0.25s ease;
|
|
204
|
+
|
|
205
|
+
&:hover,
|
|
206
|
+
&:focus {
|
|
207
|
+
opacity: 1;
|
|
208
|
+
outline: none;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
//*
|
|
215
|
+
// A list that simply arranges the contained `li`s with some spacing between
|
|
216
|
+
// them.
|
|
217
|
+
|
|
218
|
+
.unstyled-list {
|
|
219
|
+
margin: 0;
|
|
220
|
+
padding: 0;
|
|
221
|
+
list-style: none;
|
|
222
|
+
|
|
223
|
+
> li {
|
|
224
|
+
margin: double(default(spacing)) 0;
|
|
225
|
+
|
|
226
|
+
&:first-child {
|
|
227
|
+
margin-top: 0;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
BASE_CLASS = "details-sheet"
|
|
2
|
+
|
|
3
|
+
CLASSES =
|
|
4
|
+
BASE: BASE_CLASS
|
|
5
|
+
OVERLAY: "#{BASE_CLASS}__overlay"
|
|
6
|
+
CLOSER: "#{BASE_CLASS}__close"
|
|
7
|
+
NAME: "#{BASE_CLASS}__name"
|
|
8
|
+
TYPE: "#{BASE_CLASS}__type"
|
|
9
|
+
DESCRIPTION: "#{BASE_CLASS}__description"
|
|
10
|
+
PRECLUDES: "#{BASE_CLASS}__precludes"
|
|
11
|
+
ACTIVATE_WITH: "#{BASE_CLASS}__activate-with"
|
|
12
|
+
SET_BY: "#{BASE_CLASS}__set-by"
|
|
13
|
+
|
|
14
|
+
STATES =
|
|
15
|
+
BASE: ACTIVE: "#{CLASSES.BASE}--is-active"
|
|
16
|
+
OVERLAY: ACTIVE: "#{CLASSES.OVERLAY}--is-active"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
create_comma_string = (items, options = {}) ->
|
|
20
|
+
connector = options.connector || "and"
|
|
21
|
+
string = ""
|
|
22
|
+
|
|
23
|
+
for item, index in items
|
|
24
|
+
new_string = "<code>#{item}</code>"
|
|
25
|
+
new_string = ", #{new_string}" if index > 0 && index < items.length - 1
|
|
26
|
+
new_string = ", #{connector} #{new_string}" if index > 0 && index == items.length - 1 && items.length > 2
|
|
27
|
+
new_string = " #{connector} #{new_string}" if index > 0 && index == items.length - 1 && items.length == 2
|
|
28
|
+
string += new_string
|
|
29
|
+
|
|
30
|
+
string
|
|
31
|
+
|
|
32
|
+
sheet = undefined
|
|
33
|
+
|
|
34
|
+
fill_in_details = (details) ->
|
|
35
|
+
sheet.name.innerHTML = details.name
|
|
36
|
+
node.innerHTML = details.type for node in sheet.type
|
|
37
|
+
|
|
38
|
+
sheet.description.innerHTML = details.description
|
|
39
|
+
sheet.description.parentNode.style.display = if details.description.length then "" else "none"
|
|
40
|
+
|
|
41
|
+
for complex_attr in ["precludes", "activate_with", "set_by"]
|
|
42
|
+
sheet[complex_attr].innerHTML = create_comma_string(details[complex_attr])
|
|
43
|
+
sheet[complex_attr].parentNode.style.display = if details[complex_attr].length then "" else "none"
|
|
44
|
+
|
|
45
|
+
show_sheet = ->
|
|
46
|
+
sheet.base.classList.add(STATES.BASE.ACTIVE)
|
|
47
|
+
sheet.overlay.classList.add(STATES.OVERLAY.ACTIVE)
|
|
48
|
+
|
|
49
|
+
hide_sheet = ->
|
|
50
|
+
sheet.base.classList.remove(STATES.BASE.ACTIVE)
|
|
51
|
+
sheet.overlay.classList.remove(STATES.OVERLAY.ACTIVE)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
$ ->
|
|
55
|
+
node = document.querySelector(".#{CLASSES.BASE}")
|
|
56
|
+
return unless node
|
|
57
|
+
|
|
58
|
+
sheet =
|
|
59
|
+
base: node
|
|
60
|
+
overlay: node.nextElementSibling
|
|
61
|
+
name: node.querySelector(".#{CLASSES.NAME}")
|
|
62
|
+
type: node.querySelectorAll(".#{CLASSES.TYPE}")
|
|
63
|
+
description: node.querySelector(".#{CLASSES.DESCRIPTION}")
|
|
64
|
+
precludes: node.querySelector(".#{CLASSES.PRECLUDES}")
|
|
65
|
+
activate_with: node.querySelector(".#{CLASSES.ACTIVATE_WITH}")
|
|
66
|
+
set_by: node.querySelector(".#{CLASSES.SET_BY}")
|
|
67
|
+
|
|
68
|
+
$(document).on("click touchend", ".#{CLASSES.OVERLAY}", hide_sheet)
|
|
69
|
+
|
|
70
|
+
DetailsSheet =
|
|
71
|
+
present: (details) ->
|
|
72
|
+
return unless sheet
|
|
73
|
+
fill_in_details(details)
|
|
74
|
+
show_sheet()
|
|
75
|
+
|
|
76
|
+
receive: (event) ->
|
|
77
|
+
return unless event.type == Docks.EVENTS.INFO_REQUEST
|
|
78
|
+
|
|
79
|
+
@present(event.details)
|
|
80
|
+
|
|
81
|
+
Lemon.mix(Docks.Iframe.Mixins.Registerable, into: DetailsSheet)
|
|
82
|
+
$ -> Docks.Iframe.register_with_all_iframes(DetailsSheet)
|
|
83
|
+
|
|
84
|
+
window.Docks.DetailsSheet = DetailsSheet
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<div class="details-sheet">
|
|
2
|
+
<div class="details-sheet__section">
|
|
3
|
+
<h6 class="details-sheet__subtitle">Details for</h6>
|
|
4
|
+
<h5 class="details-sheet__name"></h5>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<div class="details-sheet__section">
|
|
8
|
+
<div class="details-sheet__description"></div>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<div class="details-sheet__section">
|
|
12
|
+
<p>When using this <span class="details-sheet__type"></span>, always also use <span class="details-sheet__activate-with"></span>.</p>
|
|
13
|
+
<p>Don't use this <span class="details-sheet__type"></span> with <span class="details-sheet__precludes"></span>.</p>
|
|
14
|
+
<p>This <span class="details-sheet__type"></span> is set by <span class="details-sheet__set-by"></span>.</p>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
<div class="details-sheet__overlay"></div>
|
|
File without changes
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
.details-sheet {
|
|
2
|
+
max-width: 90%;
|
|
3
|
+
position: fixed;
|
|
4
|
+
top: 50%; left: 50%;
|
|
5
|
+
transform: translate(-50%, -50%);
|
|
6
|
+
background-color: white;
|
|
7
|
+
border-radius: 0.4rem;
|
|
8
|
+
box-shadow: 0 0 10px rgba(color(black), 0.3);
|
|
9
|
+
z-index: 20;
|
|
10
|
+
display: none;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.details-sheet--is-active {
|
|
14
|
+
display: block;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.details-sheet__overlay {
|
|
18
|
+
background: rgba(color(black), 0.9);
|
|
19
|
+
position: absolute;
|
|
20
|
+
top: 0; bottom: 0;
|
|
21
|
+
right: 0; left: 0;
|
|
22
|
+
z-index: 19;
|
|
23
|
+
display: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.details-sheet__overlay--is-active {
|
|
27
|
+
display: block;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
.details-sheet__section {
|
|
32
|
+
padding: 1rem;
|
|
33
|
+
|
|
34
|
+
+ .details-sheet__section {
|
|
35
|
+
border-top: 1px solid color(sky-dark);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.details-sheet__name {
|
|
40
|
+
display: inline-block;
|
|
41
|
+
background-color: color(sky-light);
|
|
42
|
+
padding: 0.1rem 0.25em;
|
|
43
|
+
border-radius: 0.25em;
|
|
44
|
+
color: color(slate-light);
|
|
45
|
+
font-size: 1.2em;
|
|
46
|
+
font-family: Consolas, monospace;
|
|
47
|
+
margin: 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.details-sheet__subtitle {
|
|
51
|
+
margin: 0 0 0.5rem;
|
|
52
|
+
font-size: 0.6rem;
|
|
53
|
+
text-transform: uppercase;
|
|
54
|
+
color: color(slate-light);
|
|
55
|
+
opacity: 0.3;
|
|
56
|
+
font-weight: 600;
|
|
57
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//*
|
|
2
|
+
// @pattern Notice
|
|
3
|
+
//
|
|
4
|
+
// A simple, colored container around that emphasizes the contained text. This
|
|
5
|
+
// should be used for important details about a symbol; for example, to
|
|
6
|
+
// indicate that a component is deprecated or experimental.
|
|
7
|
+
//
|
|
8
|
+
// @since 1.0.0
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
//*
|
|
12
|
+
// A regular notice.
|
|
13
|
+
//
|
|
14
|
+
// @markup
|
|
15
|
+
// <div class="notice">
|
|
16
|
+
// <div class="type-container">
|
|
17
|
+
// <p>Please don't use this component anymore! It's no good.</p>
|
|
18
|
+
// </div>
|
|
19
|
+
// </div>
|
|
20
|
+
|
|
21
|
+
.notice {
|
|
22
|
+
background-color: ui-color(yellow);
|
|
23
|
+
width: fit-content;
|
|
24
|
+
color: ui-color(yellow, dark);
|
|
25
|
+
padding: 1rem;
|
|
26
|
+
border-radius: default(border-radius);
|
|
27
|
+
@include font-size(paragraph-small);
|
|
28
|
+
position: relative;
|
|
29
|
+
|
|
30
|
+
.type, p, code {
|
|
31
|
+
color: inherit;
|
|
32
|
+
font-size: inherit;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.type--heading {
|
|
36
|
+
font-weight: 400;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
//*
|
|
41
|
+
// A notice that indicates something is new about the attached symbol.
|
|
42
|
+
//
|
|
43
|
+
// @demo_type joint
|
|
44
|
+
|
|
45
|
+
.notice--new {
|
|
46
|
+
background-color: ui-color(blue);
|
|
47
|
+
color: ui-color(blue, darker);
|
|
48
|
+
}
|