@nuralyui/flex 0.0.4 → 0.0.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.
Files changed (2) hide show
  1. package/bundle.js +109 -2
  2. package/package.json +1 -1
package/bundle.js CHANGED
@@ -1,7 +1,114 @@
1
- import{css as e,LitElement as t,html as r}from"lit";import{property as n,customElement as i}from"lit/decorators.js";import{NuralyUIBaseMixin as a}from"@nuralyui/common/mixins";const s=e`:host{display:block;box-sizing:border-box}.nr-flex{display:flex;box-sizing:border-box;color:var(--nuraly-color-text)}.nr-flex[data-inline=true]{display:inline-flex}.nr-flex[data-direction=row]{flex-direction:row}.nr-flex[data-direction=row-reverse]{flex-direction:row-reverse}.nr-flex[data-direction=column]{flex-direction:column}.nr-flex[data-direction=column-reverse]{flex-direction:column-reverse}.nr-flex[data-wrap=nowrap]{flex-wrap:nowrap}.nr-flex[data-wrap=wrap]{flex-wrap:wrap}.nr-flex[data-wrap=wrap-reverse]{flex-wrap:wrap-reverse}.nr-flex[data-justify=flex-start]{justify-content:flex-start}.nr-flex[data-justify=flex-end]{justify-content:flex-end}.nr-flex[data-justify=center]{justify-content:center}.nr-flex[data-justify=space-between]{justify-content:space-between}.nr-flex[data-justify=space-around]{justify-content:space-around}.nr-flex[data-justify=space-evenly]{justify-content:space-evenly}.nr-flex[data-align=flex-start]{align-items:flex-start}.nr-flex[data-align=flex-end]{align-items:flex-end}.nr-flex[data-align=center]{align-items:center}.nr-flex[data-align=baseline]{align-items:baseline}.nr-flex[data-align=stretch]{align-items:stretch}`,l="";
1
+ import{css as e,LitElement as t,html as r}from"lit";import{property as n,customElement as i}from"lit/decorators.js";import{NuralyUIBaseMixin as a}from"@nuralyui/common/mixins";const l=e`
2
+ :host {
3
+ display: block;
4
+ box-sizing: border-box;
5
+ }
6
+
7
+ .nr-flex {
8
+ display: flex;
9
+ box-sizing: border-box;
10
+
11
+ /* Theme-aware */
12
+ color: var(--nuraly-color-text);
13
+ }
14
+
15
+ /* Inline flex */
16
+ .nr-flex[data-inline="true"] {
17
+ display: inline-flex;
18
+ }
19
+
20
+ /* Flex direction */
21
+ .nr-flex[data-direction="row"] {
22
+ flex-direction: row;
23
+ }
24
+
25
+ .nr-flex[data-direction="row-reverse"] {
26
+ flex-direction: row-reverse;
27
+ }
28
+
29
+ .nr-flex[data-direction="column"] {
30
+ flex-direction: column;
31
+ }
32
+
33
+ .nr-flex[data-direction="column-reverse"] {
34
+ flex-direction: column-reverse;
35
+ }
36
+
37
+ /* Flex wrap */
38
+ .nr-flex[data-wrap="nowrap"] {
39
+ flex-wrap: nowrap;
40
+ }
41
+
42
+ .nr-flex[data-wrap="wrap"] {
43
+ flex-wrap: wrap;
44
+ }
45
+
46
+ .nr-flex[data-wrap="wrap-reverse"] {
47
+ flex-wrap: wrap-reverse;
48
+ }
49
+
50
+ /* Justify content */
51
+ .nr-flex[data-justify="flex-start"] {
52
+ justify-content: flex-start;
53
+ }
54
+
55
+ .nr-flex[data-justify="flex-end"] {
56
+ justify-content: flex-end;
57
+ }
58
+
59
+ .nr-flex[data-justify="center"] {
60
+ justify-content: center;
61
+ }
62
+
63
+ .nr-flex[data-justify="space-between"] {
64
+ justify-content: space-between;
65
+ }
66
+
67
+ .nr-flex[data-justify="space-around"] {
68
+ justify-content: space-around;
69
+ }
70
+
71
+ .nr-flex[data-justify="space-evenly"] {
72
+ justify-content: space-evenly;
73
+ }
74
+
75
+ /* Align items */
76
+ .nr-flex[data-align="flex-start"] {
77
+ align-items: flex-start;
78
+ }
79
+
80
+ .nr-flex[data-align="flex-end"] {
81
+ align-items: flex-end;
82
+ }
83
+
84
+ .nr-flex[data-align="center"] {
85
+ align-items: center;
86
+ }
87
+
88
+ .nr-flex[data-align="baseline"] {
89
+ align-items: baseline;
90
+ }
91
+
92
+ .nr-flex[data-align="stretch"] {
93
+ align-items: stretch;
94
+ }
95
+ `,s="";
2
96
  /**
3
97
  * @license
4
98
  * Copyright 2023 Nuraly, Laabidi Aymen
5
99
  * SPDX-License-Identifier: MIT
6
100
  */
7
- var o=function(e,t,r,n){for(var i,a=arguments.length,s=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n,l=e.length-1;l>=0;l--)(i=e[l])&&(s=(a<3?i(s):a>3?i(t,r,s):i(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s};let f=class extends(a(t)){constructor(){super(...arguments),this.direction="row",this.vertical=!1,this.wrap="nowrap",this.justify="",this.align="",this.gap=0,this.inline=!1,this.flex=""}getFlexDirection(){return this.vertical?"column":this.direction}getGapValue(e){if("number"==typeof e)return`${e}px`;if("string"==typeof e)switch(e){case"small":return"var(--nuraly-spacing-2, 8px)";case"medium":return"var(--nuraly-spacing-3, 16px)";case"large":return"var(--nuraly-spacing-4, 24px)";default:return e}return"0"}getGapStyles(){const e={};if(Array.isArray(this.gap)){const[t,r]=this.gap;e["column-gap"]=this.getGapValue(t),e["row-gap"]=this.getGapValue(r)}else this.gap&&(e.gap=this.getGapValue(this.gap));return e}getFlexStyles(){const e=Object.assign({},this.getGapStyles());return this.flex&&(e.flex=this.flex),Object.entries(e).map((([e,t])=>`${e}: ${t}`)).join("; ")}render(){const e=this.getFlexDirection(),t=this.getFlexStyles();return r`<div class="nr-flex" data-direction="${e}" data-wrap="${this.wrap}" data-justify="${this.justify}" data-align="${this.align}" data-inline="${this.inline}" data-theme="${this.currentTheme}" style="${t}"><slot></slot></div>`}};f.styles=s,o([n({type:String})],f.prototype,"direction",void 0),o([n({type:Boolean})],f.prototype,"vertical",void 0),o([n({type:String})],f.prototype,"wrap",void 0),o([n({type:String})],f.prototype,"justify",void 0),o([n({type:String})],f.prototype,"align",void 0),o([n({type:Object})],f.prototype,"gap",void 0),o([n({type:Boolean})],f.prototype,"inline",void 0),o([n({type:String})],f.prototype,"flex",void 0),f=o([i("nr-flex")],f);export{l as EMPTY_STRING,f as NrFlexElement};
101
+ var o=function(e,t,r,n){for(var i,a=arguments.length,l=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n,s=e.length-1;s>=0;s--)(i=e[s])&&(l=(a<3?i(l):a>3?i(t,r,l):i(t,r))||l);return a>3&&l&&Object.defineProperty(t,r,l),l};let f=class extends(a(t)){constructor(){super(...arguments),this.direction="row",this.vertical=!1,this.wrap="nowrap",this.justify="",this.align="",this.gap=0,this.inline=!1,this.flex=""}getFlexDirection(){return this.vertical?"column":this.direction}getGapValue(e){if("number"==typeof e)return`${e}px`;if("string"==typeof e)switch(e){case"small":return"var(--nuraly-spacing-2, 8px)";case"medium":return"var(--nuraly-spacing-3, 16px)";case"large":return"var(--nuraly-spacing-4, 24px)";default:return e}return"0"}getGapStyles(){const e={};if(Array.isArray(this.gap)){const[t,r]=this.gap;e["column-gap"]=this.getGapValue(t),e["row-gap"]=this.getGapValue(r)}else this.gap&&(e.gap=this.getGapValue(this.gap));return e}getFlexStyles(){const e=Object.assign({},this.getGapStyles());return this.flex&&(e.flex=this.flex),Object.entries(e).map((([e,t])=>`${e}: ${t}`)).join("; ")}render(){const e=this.getFlexDirection(),t=this.getFlexStyles();return r`
102
+ <div
103
+ class="nr-flex"
104
+ data-direction="${e}"
105
+ data-wrap="${this.wrap}"
106
+ data-justify="${this.justify}"
107
+ data-align="${this.align}"
108
+ data-inline="${this.inline}"
109
+ data-theme="${this.currentTheme}"
110
+ style="${t}"
111
+ >
112
+ <slot></slot>
113
+ </div>
114
+ `}};f.styles=l,o([n({type:String})],f.prototype,"direction",void 0),o([n({type:Boolean})],f.prototype,"vertical",void 0),o([n({type:String})],f.prototype,"wrap",void 0),o([n({type:String})],f.prototype,"justify",void 0),o([n({type:String})],f.prototype,"align",void 0),o([n({type:Object})],f.prototype,"gap",void 0),o([n({type:Boolean})],f.prototype,"inline",void 0),o([n({type:String})],f.prototype,"flex",void 0),f=o([i("nr-flex")],f);export{s as EMPTY_STRING,f as NrFlexElement};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuralyui/flex",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "Flex layout component for NuralyUI library",
5
5
  "main": "index.js",
6
6
  "type": "module",