Skip to content

Commit e36b871

Browse files
b210
1 parent 685cae7 commit e36b871

8 files changed

Lines changed: 34 additions & 24 deletions

File tree

src/Core/Global/Getters.scss

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
@use "sass:list" as *;
88
@use "../Theme/Getters" as *;
99
@use "../../options" as option;
10-
@use "../../Modules/Utilities/index" as helper;
11-
@use "Helpers";
10+
@use "../../Modules/Utilities/index" as utility;
11+
@use "Helpers" as helper;
1212

1313
///
1414
/// Get options value by key
@@ -24,11 +24,11 @@
2424
@function options($keys...)
2525
{
2626
@if length($keys) > 4 {
27-
@warn "[PUNICA] The Maximum Nesting Depth is Restricted to 4.";
27+
@warn helper.$nesting-depth;
2828
}
2929

3030
@if map.get(option.$options, nth($keys, 1)) == null {
31-
@warn "[PUNICA] INVALID KEY: #{nth($keys, 1)}" + ' key is not found or key returns null in the [options.scss] file.';
31+
@warn helper.$invalid-key + " #{nth($keys, 1)} " + helper.$key-not-found;
3232
@return null;
3333
}
3434

@@ -41,21 +41,21 @@
4141
$value: map.get($value, nth($keys, 2));
4242

4343
@if $value == null {
44-
@warn "[PUNICA] INVALID KEY: #{nth($keys, 1)} > #{nth($keys, 2)}" + ' key is not found or key returns null in the [options.scss] file.';
44+
@warn helper.$invalid-key + " #{nth($keys, 1)} > #{nth($keys, 2)} " + helper.$key-not-found;
4545
@return null;
4646
}
4747

4848
@if length($keys) > 2 {
4949
$value: map.get($value, nth($keys, 3));
5050
@if $value == null {
51-
@warn "[PUNICA] INVALID KEY: #{nth($keys, 1)} > #{nth($keys, 2)} > #{nth($keys, 3)}" + ' key is not found or key returns null in the [options.scss] file.';
51+
@warn helper.$invalid-key + " #{nth($keys, 1)} > #{nth($keys, 2)} > #{nth($keys, 3)} " + helper.$key-not-found;
5252
@return null;
5353
}
5454

5555
@if length($keys) > 3 {
5656
$value: map.get($value, nth($keys, 4));
5757
@if $value == null {
58-
@warn "[PUNICA] INVALID KEY: #{nth($keys, 1)} > #{nth($keys, 2)} > #{nth($keys, 3)} > #{nth($keys, 4)}" + ' key is not found or key returns null in the [options.scss] file.';
58+
@warn helper.$invalid-key + " #{nth($keys, 1)} > #{nth($keys, 2)} > #{nth($keys, 3)} > #{nth($keys, 4)} " + helper.$key-not-found;
5959
@return null;
6060
}
6161
}
@@ -81,7 +81,7 @@
8181
$settings: map.get(map.get(options($node), 'settings'), nth($keys, 1));
8282

8383
@if $settings == null {
84-
@warn "[PUNICA] INVALID KEY: #{$node} > settings > #{nth($keys, 1)}" + ' key is not found or key returns null in the [options.scss] file.';
84+
@warn helper.$invalid-key + " #{$node} > settings > #{nth($keys, 1)} " + helper.$key-not-found;
8585
@return null;
8686
}
8787

@@ -92,15 +92,15 @@
9292
$settings: map.get($settings, nth($keys, 2));
9393

9494
@if $settings == null {
95-
@warn "[PUNICA] INVALID KEY: #{$node} > settings > #{nth($keys, 1)} > #{nth($keys, 2)}" + ' key is not found or key returns null in the [options.scss] file.';
95+
@warn helper.$invalid-key + " #{$node} > settings > #{nth($keys, 1)} > #{nth($keys, 2)} " + helper.$key-not-found;
9696
@return null;
9797
}
9898

9999
@if length($keys) > 2 {
100100
$settings : map.get($settings, nth($keys, 3));
101101

102102
@if $settings == null {
103-
@warn "[PUNICA] INVALID KEY: #{$node} > settings > #{nth($keys, 1)} > #{nth($keys, 2)} > #{nth($keys, 3)}" + ' key is not found or key returns null in the [options.scss] file.';
103+
@warn helper.$invalid-key + " #{$node} > settings > #{nth($keys, 1)} > #{nth($keys, 2)} > #{nth($keys, 3)} " + helper.$key-not-found;
104104
@return null;
105105
}
106106
}
@@ -147,7 +147,7 @@
147147
@return theme('utilities', $node, $key);
148148
}
149149

150-
$util: if(map.has-key(helper.$helpers, $node), map.get(helper.$helpers, $node), null);
150+
$util: if(map.has-key(utility.$helpers, $node), map.get(utility.$helpers, $node), null);
151151

152152
@if ($util != null) and $key {
153153
$util: if(map.has-key($util, $key), map.get($util, $key), null);

src/Core/Global/Helpers.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@
33
/// Core/Global/Helpers.scss
44
//
55

6+
$invalid-key : "[PUNICA] INVALID KEY:";
7+
$key-not-found: "key is not found or key returns null in the [options.scss] file.";
8+
$nesting-depth: "[PUNICA] The maximum nesting depth is restricted to 4.";
9+
610
///
711
/// @param {String} $theme
812
///
13+
/// @return string
14+
///
915
@function theme-not-found($theme)
1016
{
1117
$error: "[PUNICA] Invalid theme name: [#{$theme}]. Punica's theme map does not contains a key name associated with '#{$theme}'. Please check the 'themes.scss' file.";

src/Core/Global/Options.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
@use "sass:list" as *;
88
@use "../Theme/Getters" as *;
99
@use "Getters" as get;
10+
@use "Helpers" as helper;
1011

1112
///
1213
/// Get a specific component's variable from the theme map
@@ -97,7 +98,7 @@
9798
@function set_variable($module, $keys...)
9899
{
99100
@if length($keys) > 4 {
100-
@warn "[PUNICA] The Maximum Nesting Depth is Restricted to 4.";
101+
@warn helper.$nesting-depth;
101102
}
102103

103104
@if theme($module, nth($keys, 1), nth($keys, 2)) {

src/Core/Theme/Getters.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55

66
@use "sass:map" as map;
77
@use "sass:list" as list;
8+
@use "../Global/Helpers" as helper;
89

910
/// ======================================================
10-
$theme-map: null !default;
11+
$theme: null !default;
1112
/// ======================================================
1213

1314
///
@@ -25,10 +26,10 @@
2526
@function theme($node, $keys...)
2627
{
2728
@if list.length($keys) > 4 {
28-
@warn "[PUNICA] The Maximum Nesting Depth is Restricted to 4.";
29+
@warn helper.$nesting-depth;
2930
}
3031

31-
$value: if(map.has-key($theme-map, $node), map.get($theme-map, $node), null);
32+
$value: if(map.has-key($theme, $node), map.get($theme, $node), null);
3233

3334
@if (list.length($keys) > 0) {
3435
@for $key from 1 through list.length($keys) {

src/Modules/Components/Menu/Menu.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@
8282
margin-right : components('menu', 'icon', 'margin-right');
8383
vertical-align: components('menu', 'icon', 'vertical-align');
8484
}
85+
// Sub Menu
8586
// .menu .item .menu
8687
.#{class('menu', 'name')} {
87-
padding: components('menu', 'item', 'sub-menu', 'padding');
88+
padding: components('menu', 'item', 'menu', 'padding');
8889
}
8990
}
9091
// .menu .badge

src/options.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,8 @@ $options: (
454454
'color' : theme('color', 'text'),
455455
'background-color': color.$grey
456456
),
457-
'sub-menu': (
457+
// sub menu
458+
'menu': (
458459
'padding': .4rem // padding of sub items
459460
)
460461
),

src/punica.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
/// ======================================================
1111
$active-theme: default;
1212
/// ======================================================
13-
$theme: if(map.has-key(get.$themes, $active-theme), $active-theme, theme-not-found($active-theme));
14-
$theme-map: map.get(get.$themes, $theme) !global;
13+
$theme-name: if(map.has-key(get.$themes, $active-theme), $active-theme, theme-not-found($active-theme));
14+
$theme : map.get(get.$themes, $theme-name) !global;
1515
/// ======================================================
1616

1717
/*!
@@ -28,4 +28,4 @@
2828
@use "Modules/Components/index" as components;
2929
@use "Modules/Utilities/helpers";
3030
@debug "#{theme('name')} is compiled successfully.";
31-
$theme-map: null !global;
31+
$theme: null !global;

src/themes.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ $themes: (
5555
*/
5656
),
5757
'components': (
58-
'tabnav': (
58+
/*'tabnav': (
5959
'border-bottom': 4px
60-
),
60+
),*/
6161
/*
6262
'navbar': (
6363
'brand': (
@@ -70,9 +70,9 @@ $themes: (
7070
*/
7171
),
7272
'elements': (
73-
'button': (
73+
/*'button': (
7474
'font-weight': 500
75-
)
75+
)*/
7676
),
7777
// You can use this section to override/change the
7878
// all default variable of utilities in the

0 commit comments

Comments
 (0)