archetype 1.0.0.alpha.4 → 1.0.0.alpha.5
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 +4 -4
- data/CHANGELOG.md +13 -1
- data/README.md +1 -1
- data/VERSION +1 -1
- data/lib/archetype.rb +7 -3
- data/lib/archetype/functions/helpers.rb +9 -1
- data/lib/archetype/sass_extensions/functions/locale.rb +0 -1
- data/lib/archetype/sass_extensions/functions/styleguide/styles.rb +3 -1
- data/lib/archetype/sass_extensions/functions/ui/scopes.rb +68 -2
- data/lib/archetype/sass_extensions/functions/util/spacing.rb +3 -0
- data/stylesheets/archetype/config/_environment.scss +1 -1
- data/stylesheets/archetype/ui/_breakpoints.scss +16 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0bc82e5733b933600bff5fc78a4e15fadbac5d7
|
4
|
+
data.tar.gz: acdbfc8bd52ce18e9f9596776047808e15ada9b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d7ed1d20f1227f1b7e1401b46043c44fd5951dacf32953c87055e94af7acb3fa0db5af502bdc5bc6e212a5060a0087dea4a2b95d4b3880b8c2c6aced6de8c16
|
7
|
+
data.tar.gz: a446520fe402c5b05ec8f592fc4755ebf3bef225281847e32b226ddb1bf3d0fb12d9cac925a71d65d38d75ffeecaee012845f496176851dafcc9985ee5647d4e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.0.0.alpha.5 (unreleased)
|
4
|
+
|
5
|
+
### New Features:
|
6
|
+
|
7
|
+
- added `enable-breakpoint` and `disable-breakpoint` functions for toggling breakpoint output on/off
|
8
|
+
- added `archetype-bundled` extension which is a "kitchen sink" bundle of Archetype core and all official extensions
|
9
|
+
- added `styleguide_allow_missing` compiler option to force errors on missing styleguide identifiers
|
10
|
+
|
11
|
+
### Resolved Issues:
|
12
|
+
|
13
|
+
- allow non-multiplier values in `*-spacing` methods
|
14
|
+
|
3
15
|
## 1.0.0.alpha.4
|
4
16
|
|
5
17
|
### Resolved Issues:
|
@@ -227,7 +239,7 @@
|
|
227
239
|
|
228
240
|
- `styleguide-add-component`, `styleguide-extend-component`, and `styleguide` now take a `$theme` parameter
|
229
241
|
- `$CONFIG_THEME` can change the global theme
|
230
|
-
- `$
|
242
|
+
- `$CONFIG_DISABLE_STYLEGUIDE_SPRITES` will prevent styleguide sprites from being generated if set to `true`
|
231
243
|
- theme components are cached
|
232
244
|
- `styleguide` calls are memoized
|
233
245
|
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Archetype
|
2
2
|
|
3
|
-
[](https://travis-ci.org/linkedin/archetype) [](http://badge.fury.io/rb/archetype)
|
3
|
+
[](https://travis-ci.org/linkedin/archetype) [](http://badge.fury.io/rb/archetype) [](https://inch-ci.org/github/linkedin/archetype/)
|
4
4
|
[](https://gemnasium.com/eoneill/archetype)
|
5
5
|
|
6
6
|
Archetype is a Compass/Sass based framework for authoring configurable, composable UI components and patterns.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.0.alpha.
|
1
|
+
1.0.0.alpha.5
|
data/lib/archetype.rb
CHANGED
@@ -34,14 +34,18 @@ module Archetype
|
|
34
34
|
Compass::Configuration.add_configuration_property(:memoize, "should the memoizer be used to improve compilation speed") do
|
35
35
|
not (Compass.configuration.environment || :development).to_s.include?('dev')
|
36
36
|
end
|
37
|
-
#
|
37
|
+
# archetype_meta
|
38
38
|
Compass::Configuration.add_configuration_property(:archetype_meta, "any meta data you want made available to the environment") do
|
39
39
|
{}
|
40
40
|
end
|
41
|
-
#
|
42
|
-
Compass::Configuration.add_configuration_property(:styleguide_debug, "if true
|
41
|
+
# styleguide_debug
|
42
|
+
Compass::Configuration.add_configuration_property(:styleguide_debug, "if `true`, detailed debugging is turned on for styleguide components") do
|
43
43
|
false
|
44
44
|
end
|
45
|
+
# styleguide_allow_missing
|
46
|
+
Compass::Configuration.add_configuration_property(:styleguide_allow_missing, "if `false`, will hard error on missing styleguide components, otherwise will throw a warning") do
|
47
|
+
true
|
48
|
+
end
|
45
49
|
end
|
46
50
|
|
47
51
|
def self.name
|
@@ -19,7 +19,7 @@ module Archetype::Functions::Helpers
|
|
19
19
|
# provides a convenience interface to the Compass::Logger
|
20
20
|
#
|
21
21
|
def self.logger
|
22
|
-
@logger ||= Compass::Logger.new
|
22
|
+
@logger ||= ::Compass::Logger.new
|
23
23
|
end
|
24
24
|
|
25
25
|
#
|
@@ -29,6 +29,14 @@ module Archetype::Functions::Helpers
|
|
29
29
|
logger.record(:warning, msg)
|
30
30
|
end
|
31
31
|
|
32
|
+
#
|
33
|
+
# provides a convenience interface for logging errors
|
34
|
+
#
|
35
|
+
def self.error(msg)
|
36
|
+
logger.record(:error, msg)
|
37
|
+
raise RuntimeError.new
|
38
|
+
end
|
39
|
+
|
32
40
|
#
|
33
41
|
# provides a convenience interface for logging debug messages
|
34
42
|
# silently captures failures
|
@@ -25,7 +25,6 @@ module Archetype::SassExtensions::Locale
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
return Sass::Script::Bool.new(
|
28
|
-
locales.include?(locale) ||
|
29
28
|
locales.include?("#{locale[:language]}_#{locale[:territory]}") ||
|
30
29
|
locales.include?(locale[:language] + '_') ||
|
31
30
|
locales.include?('_' + locale[:territory])
|
@@ -120,8 +120,10 @@ module Archetype::SassExtensions::Styleguide
|
|
120
120
|
end
|
121
121
|
styles = styles.rmerge(extracted)
|
122
122
|
elsif not helpers.is_value(sentence, :nil)
|
123
|
+
severity = Compass.configuration.styleguide_allow_missing ? :warn : :error
|
123
124
|
msg = modifiers.length > 0 ? "please specify one of: #{modifiers.sort.join(', ')}" : "there are no registered components"
|
124
|
-
|
125
|
+
msg = "[#{Archetype.name}:styleguide:identifier] `#{helpers.to_str(sentence)}` does not contain an identifier. #{msg}"
|
126
|
+
helpers.method(severity).call(msg)
|
125
127
|
end
|
126
128
|
end
|
127
129
|
|
@@ -22,7 +22,7 @@ module Archetype::SassExtensions::UI::Scopes
|
|
22
22
|
# otherwise, if the current value is different...
|
23
23
|
elsif breakpoints[key] != value
|
24
24
|
# throw a warning
|
25
|
-
helpers.warn("[#{Archetype.name}:breakpoint] a breakpoint for `#{key}` is already set to `#{breakpoints[key]}`, ignoring `#{value}`")
|
25
|
+
helpers.warn("[#{Archetype.name}:breakpoint:register] a breakpoint for `#{key}` is already set to `#{breakpoints[key]}`, ignoring `#{value}`")
|
26
26
|
return bool(false)
|
27
27
|
end
|
28
28
|
environment.global_env.set_var('CONFIG_BREAKPOINTS', Sass::Script::Value::Map.new(breakpoints))
|
@@ -40,10 +40,44 @@ module Archetype::SassExtensions::UI::Scopes
|
|
40
40
|
# - {*} the registered breakpoint
|
41
41
|
#
|
42
42
|
def get_breakpoint(key)
|
43
|
-
|
43
|
+
if disabled_breakpoints.include?(key)
|
44
|
+
helpers.debug("[#{Archetype.name}:breakpoint:get] a breakpoint for `#{key}` was found, but is currently disabled (most likely with `toggle-breakpoint` or `disable-breakpoint`).")
|
45
|
+
return null
|
46
|
+
end
|
47
|
+
breakpoint = registered_breakpoints[key] || null
|
48
|
+
if breakpoint.nil? || helpers.is_null(breakpoint)
|
49
|
+
helpers.warn("[#{Archetype.name}:breakpoint:get] a breakpoint for `#{key}` was not found.")
|
50
|
+
end
|
51
|
+
return breakpoint
|
44
52
|
end
|
45
53
|
Sass::Script::Functions.declare :get_breakpoint, [:key]
|
46
54
|
|
55
|
+
#
|
56
|
+
# Enable a breakpoint.
|
57
|
+
#
|
58
|
+
# *Parameters*:
|
59
|
+
# - <tt>$key</tt> {String} the key to enable.
|
60
|
+
# *Returns*:
|
61
|
+
# - {Boolean} true, if the key is enabled successfully
|
62
|
+
#
|
63
|
+
def enable_breakpoint(key)
|
64
|
+
return toggle_breakpoint(key, true)
|
65
|
+
end
|
66
|
+
Sass::Script::Functions.declare :enable_breakpoint, [:key]
|
67
|
+
|
68
|
+
#
|
69
|
+
# Disable a breakpoint.
|
70
|
+
#
|
71
|
+
# *Parameters*:
|
72
|
+
# - <tt>$key</tt> {String} the key to disable.
|
73
|
+
# *Returns*:
|
74
|
+
# - {Boolean} true, if the key disabled successfully
|
75
|
+
#
|
76
|
+
def disable_breakpoint(key)
|
77
|
+
return toggle_breakpoint(key, false)
|
78
|
+
end
|
79
|
+
Sass::Script::Functions.declare :disable_breakpoint, [:key]
|
80
|
+
|
47
81
|
#
|
48
82
|
# convert a modifier/element context to a BEM style selector
|
49
83
|
#
|
@@ -93,4 +127,36 @@ private
|
|
93
127
|
breakpoints.respond_to?(:to_h) ? breakpoints.to_h : {}
|
94
128
|
end
|
95
129
|
|
130
|
+
def disabled_breakpoints
|
131
|
+
breakpoints = environment.var('CONFIG_BREAKPOINTS_DISABLED')
|
132
|
+
breakpoints.respond_to?(:to_a) ? breakpoints.to_a : {}
|
133
|
+
end
|
134
|
+
|
135
|
+
# Enable or disable a breakpoint.
|
136
|
+
#
|
137
|
+
# *Parameters*:
|
138
|
+
# - <tt>$key</tt> {String} the key to enable or disable.
|
139
|
+
# - <tt>$toggle</tt> {Boolean} Set to true to enable the breakpoint. false to disable it.
|
140
|
+
# *Returns*:
|
141
|
+
# - {Boolean} true, if the disable or enable operation was successful.
|
142
|
+
#
|
143
|
+
def toggle_breakpoint(key, toggle)
|
144
|
+
friendly_method = toggle ? 'enable' : 'disable'
|
145
|
+
if registered_breakpoints[key].nil? || helpers.is_null(registered_breakpoints[key])
|
146
|
+
helpers.warn("[#{Archetype.name}:breakpoint:#{friendly_method}] a breakpoint for `#{key}` was not found.")
|
147
|
+
return bool(false)
|
148
|
+
end
|
149
|
+
|
150
|
+
method = toggle ? 'delete' : 'add'
|
151
|
+
|
152
|
+
# this will ensure that there aren't any duplicate keys
|
153
|
+
breakpoints = Set.new(disabled_breakpoints)
|
154
|
+
breakpoints.method(method).call(key)
|
155
|
+
|
156
|
+
breakpoints = Sass::Script::Value::List.new(breakpoints, :space)
|
157
|
+
environment.global_env.set_var('CONFIG_BREAKPOINTS_DISABLED', breakpoints)
|
158
|
+
|
159
|
+
return bool(true)
|
160
|
+
end
|
161
|
+
|
96
162
|
end
|
@@ -36,6 +36,9 @@ module Archetype::SassExtensions::Util::Spacing
|
|
36
36
|
#
|
37
37
|
def _spacing(unit = null, direction = identifier(horizontal), abuse = bool(false))
|
38
38
|
return null if helpers.is_null(unit)
|
39
|
+
|
40
|
+
return unit unless (unit.is_a?(Sass::Script::Value::Number) && unitless(unit).to_bool)
|
41
|
+
|
39
42
|
unit = _archetype_integerize(unit, abuse)
|
40
43
|
direction = helpers.to_str(direction) == 'vertical' ? 'VERTICAL' : 'HORIZONTAL'
|
41
44
|
config = "CONFIG_#{direction}_SPACING"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
// environment
|
2
2
|
$CONFIG_DEBUG_ENVS: (dev development) !default; // environments to allow debug in
|
3
|
-
$CONFIG_DEBUG: (index($CONFIG_DEBUG_ENVS, archetype-env())
|
3
|
+
$CONFIG_DEBUG: (not not index($CONFIG_DEBUG_ENVS, archetype-env())) !default; // global debugging mode (enabled by default in $CONFIG_DEBUG_ENVS)
|
4
4
|
|
5
5
|
$CONFIG_LOCALE: locale() !default; // the default locale
|
6
6
|
|
@@ -2,18 +2,26 @@
|
|
2
2
|
|
3
3
|
// wraps the content block in a breakpoint media query
|
4
4
|
// @mixin breakpoint
|
5
|
-
// @param $key {String} the breakpoint to use
|
5
|
+
// @param $key... {String} the breakpoint(s) to use
|
6
6
|
// @content
|
7
|
-
@mixin breakpoint($key) {
|
8
|
-
$
|
9
|
-
|
10
|
-
|
7
|
+
@mixin breakpoint($key...) {
|
8
|
+
$breakpoints: ();
|
9
|
+
|
10
|
+
@each $name in $key {
|
11
|
+
$breakpoint: get-breakpoint($name);
|
12
|
+
|
13
|
+
// if we got a valid breakpoint, keep it...
|
14
|
+
@if $breakpoint {
|
15
|
+
$breakpoints: append($breakpoints, $breakpoint, comma);
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
// output all of our collected breakpoints
|
20
|
+
@if length($breakpoints) > 0 {
|
21
|
+
@media #{$breakpoints} {
|
11
22
|
/* [archetype:breakpoint:begin] --- #{$key} --- */
|
12
23
|
@content;
|
13
24
|
/* [archetype:breakpoint:end] --- #{$key} --- */
|
14
25
|
}
|
15
26
|
}
|
16
|
-
@else {
|
17
|
-
@warn "[archetype:breakpoint] could not find a breakpoint for `#{$key}`";
|
18
|
-
}
|
19
27
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: archetype
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.alpha.
|
4
|
+
version: 1.0.0.alpha.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eugene ONeill
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-02-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: compass
|