diff options
| author | Henry Jameson <me@hjkos.com> | 2024-02-15 20:20:27 +0200 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2024-02-15 20:20:27 +0200 |
| commit | 96e3a1593ab6b45b2b6794e353623d0e87a7d8ff (patch) | |
| tree | d4cd8d68368e3a04032ccd35e3c45f1705781449 /src/components | |
| parent | 34e4dd0a79cdc03976c4137969beb4259ecdf500 (diff) | |
more optimizations, execution is now split into eager (for main UI) and
lazy (for modals, popovers etc) parts
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/alert.style.js | 42 | ||||
| -rw-r--r-- | src/components/badge.style.js | 25 | ||||
| -rw-r--r-- | src/components/button.style.js | 22 | ||||
| -rw-r--r-- | src/components/button_unstyled.style.js | 3 | ||||
| -rw-r--r-- | src/components/menu_item.style.js | 3 | ||||
| -rw-r--r-- | src/components/modals.style.js | 1 | ||||
| -rw-r--r-- | src/components/panel.style.js | 3 | ||||
| -rw-r--r-- | src/components/panel_header.style.js | 4 | ||||
| -rw-r--r-- | src/components/popover.style.js | 2 | ||||
| -rw-r--r-- | src/components/top_bar.style.js | 3 | ||||
| -rw-r--r-- | src/components/underlay.style.js | 3 |
11 files changed, 84 insertions, 27 deletions
diff --git a/src/components/alert.style.js b/src/components/alert.style.js new file mode 100644 index 00000000..081031d7 --- /dev/null +++ b/src/components/alert.style.js @@ -0,0 +1,42 @@ +export default { + name: 'Alert', + selector: '.alert', + validInnerComponents: [ + 'Text', + 'Icon', + 'Link', + 'Border' + ], + variants: { + normal: '.neutral', + error: '.error', + warning: '.warning', + success: '.success' + }, + defaultRules: [ + { + directives: { + background: '--text', + opacity: 0.8 + } + }, + { + variant: 'error', + directives: { + background: '--cRed' + } + }, + { + variant: 'warning', + directives: { + background: '--cOrange' + } + }, + { + variant: 'success', + directives: { + background: '--cGreen' + } + } + ] +} diff --git a/src/components/badge.style.js b/src/components/badge.style.js new file mode 100644 index 00000000..3ac7d8c0 --- /dev/null +++ b/src/components/badge.style.js @@ -0,0 +1,25 @@ +export default { + name: 'Badge', + selector: '.badge', + validInnerComponents: [ + 'Text', + 'Icon' + ], + variants: { + normal: '.neutral', + notification: '.notification' + }, + defaultRules: [ + { + directives: { + background: '--cGreen' + } + }, + { + variant: 'notification', + directives: { + background: '--cRed' + } + } + ] +} diff --git a/src/components/button.style.js b/src/components/button.style.js index 900eef26..9f238b4e 100644 --- a/src/components/button.style.js +++ b/src/components/button.style.js @@ -38,11 +38,11 @@ export default { // All states inherit from "normal" state, there is no other inheirtance, i.e. hover+disabled only inherits from "normal", not from hover nor disabled. // However, cascading still works, so resulting state will be result of merging of all relevant states/variants // normal: '' // normal state is implicitly added, it is always included - disabled: ':disabled', toggled: '.toggled', pressed: ':active', hover: ':hover', - focused: ':focus-within' + focused: ':focus-within', + disabled: ':disabled' }, // Variants are mutually exclusive, each component implicitly has "normal" variant, and all other variants inherit from it. variants: { @@ -108,13 +108,6 @@ export default { } }, { - state: ['disabled', 'hover'], - directives: { - background: '$blend(--background, 0.25, --parent)', - shadow: [...buttonInsetFakeBorders] - } - }, - { component: 'Text', parent: { component: 'Button', @@ -124,17 +117,6 @@ export default { textOpacity: 0.25, textOpacityMode: 'blend' } - }, - { - component: 'Text', - parent: { - component: 'Button', - state: ['disabled', 'hover'] - }, - directives: { - textOpacity: 0.25, - textOpacityMode: 'blend' - } } ] } diff --git a/src/components/button_unstyled.style.js b/src/components/button_unstyled.style.js index a96cb7b6..e80322eb 100644 --- a/src/components/button_unstyled.style.js +++ b/src/components/button_unstyled.style.js @@ -10,7 +10,8 @@ export default { }, validInnerComponents: [ 'Text', - 'Icon' + 'Icon', + 'Badge' ], defaultRules: [ { diff --git a/src/components/menu_item.style.js b/src/components/menu_item.style.js index 716edfa7..6475395a 100644 --- a/src/components/menu_item.style.js +++ b/src/components/menu_item.style.js @@ -5,7 +5,8 @@ export default { 'Text', 'Icon', 'Input', - 'Border' + 'Border', + 'ButtonUnstyled' ], states: { hover: ':hover', diff --git a/src/components/modals.style.js b/src/components/modals.style.js index 3cfddf2f..c401a0cd 100644 --- a/src/components/modals.style.js +++ b/src/components/modals.style.js @@ -1,6 +1,7 @@ export default { name: 'Modals', selector: '.modal-view', + lazy: true, validInnerComponents: [ 'Panel' ], diff --git a/src/components/panel.style.js b/src/components/panel.style.js index 2f6f92b5..f5226cce 100644 --- a/src/components/panel.style.js +++ b/src/components/panel.style.js @@ -11,7 +11,8 @@ export default { 'PanelHeader', 'MenuItem', 'Post', - 'Notification' + 'Notification', + 'Alert' ], defaultRules: [ { diff --git a/src/components/panel_header.style.js b/src/components/panel_header.style.js index c32304e1..5f108b41 100644 --- a/src/components/panel_header.style.js +++ b/src/components/panel_header.style.js @@ -6,7 +6,9 @@ export default { 'Link', 'Icon', 'Button', - 'ButtonUnstyled' + 'ButtonUnstyled', + 'Badge', + 'Alert' ], defaultRules: [ { diff --git a/src/components/popover.style.js b/src/components/popover.style.js index 7d58859d..a73d484a 100644 --- a/src/components/popover.style.js +++ b/src/components/popover.style.js @@ -1,8 +1,8 @@ export default { name: 'Popover', selector: '.popover', + lazy: true, variants: { - tooltip: '.tooltip', modal: '.modal' }, validInnerComponents: [ diff --git a/src/components/top_bar.style.js b/src/components/top_bar.style.js index fd400522..c02fecf1 100644 --- a/src/components/top_bar.style.js +++ b/src/components/top_bar.style.js @@ -7,7 +7,8 @@ export default { 'Icon', 'Button', 'ButtonUnstyled', - 'Input' + 'Input', + 'Badge' ], defaultRules: [ { diff --git a/src/components/underlay.style.js b/src/components/underlay.style.js index 68fd6c06..afe5a208 100644 --- a/src/components/underlay.style.js +++ b/src/components/underlay.style.js @@ -6,7 +6,8 @@ export default { // we are searching for underlay specifically or for whatever is laid on top of it. outOfTreeSelector: '.underlay', validInnerComponents: [ - 'Panel' + 'Panel', + 'Alert' ], defaultRules: [ { |
