@nuralyui/layout 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.
- package/bundle.js +220 -1
- package/package.json +1 -1
package/bundle.js
CHANGED
|
@@ -1 +1,220 @@
|
|
|
1
|
-
import{css as r,LitElement as t,html as e}from"lit";import{property as i,queryAssignedElements as o,customElement as a,state as n}from"lit/decorators.js";import{NuralyUIBaseMixin as l}from"@nuralyui/common/mixins";import{classMap as s}from"lit/directives/class-map.js";const d=r`:host{display:flex;flex:auto;flex-direction:column;min-height:0;background:var(--nuraly-layout-background)}:host([has-sider]){flex-direction:row}.nr-layout{display:flex;flex:auto;flex-direction:inherit;min-height:0;width:100%}`;var u=function(r,t,e,i){for(var o,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,e):i,l=r.length-1;l>=0;l--)(o=r[l])&&(n=(a<3?o(n):a>3?o(t,e,n):o(t,e))||n);return a>3&&n&&Object.defineProperty(t,e,n),n};let h=class extends(l(t)){constructor(){super(...arguments),this.hasSider=!1}connectedCallback(){super.connectedCallback(),this.detectSider()}updated(r){super.updated(r),this.detectSider()}detectSider(){var r;const t=null===(r=this.shadowRoot)||void 0===r?void 0:r.querySelector("slot");if(t){const r=t.assignedElements().some((r=>"nr-sider"===r.tagName.toLowerCase()));this.hasSider!==r&&(this.hasSider=r)}}handleSlotChange(){this.detectSider()}render(){return e`<div class="nr-layout" part="layout"><slot @slotchange="${this.handleSlotChange}"></slot></div>`}};h.styles=d,u([i({type:Boolean,reflect:!0,attribute:"has-sider"})],h.prototype,"hasSider",void 0),u([o({selector:"nr-sider"})],h.prototype,"connectedCallback",null),h=u([a("nr-layout")],h);const g=r`:host{display:block}.nr-header{display:flex;align-items:center;padding:var(--nuraly-layout-header-padding);height:var(--nuraly-layout-header-height);line-height:var(--nuraly-layout-header-height);background:var(--nuraly-layout-header-background);color:var(--nuraly-layout-header-text);border-bottom:1px solid var(--nuraly-layout-header-border);transition:var(--nuraly-layout-transition)}`;var c=function(r,t,e,i){for(var o,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,e):i,l=r.length-1;l>=0;l--)(o=r[l])&&(n=(a<3?o(n):a>3?o(t,e,n):o(t,e))||n);return a>3&&n&&Object.defineProperty(t,e,n),n};let y=class extends(l(t)){constructor(){super(...arguments),this.height="64px"}render(){return e`<header class="nr-header" part="header" style="height:${this.height}"><slot></slot></header>`}};y.styles=g,c([i({type:String})],y.prototype,"height",void 0),y=c([a("nr-header")],y);const p=r`:host{display:block}.nr-footer{padding:var(--nuraly-layout-footer-padding);background:var(--nuraly-layout-footer-background);color:var(--nuraly-layout-footer-text);border-top:1px solid var(--nuraly-layout-footer-border);font-size:var(--nuraly-layout-font-size);line-height:var(--nuraly-layout-line-height);transition:var(--nuraly-layout-transition)}`;var v=function(r,t,e,i){for(var o,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,e):i,l=r.length-1;l>=0;l--)(o=r[l])&&(n=(a<3?o(n):a>3?o(t,e,n):o(t,e))||n);return a>3&&n&&Object.defineProperty(t,e,n),n};let b=class extends(l(t)){constructor(){super(...arguments),this.padding="24px 50px"}render(){return e`<footer class="nr-footer" part="footer" style="padding:${this.padding}"><slot></slot></footer>`}};b.styles=p,v([i({type:String})],b.prototype,"padding",void 0),b=v([a("nr-footer")],b);const f=r`:host{display:block;position:relative}.nr-sider{position:relative;display:flex;flex-direction:column;min-width:0;background:var(--nuraly-layout-sider-background);color:var(--nuraly-layout-sider-text);border-right:1px solid var(--nuraly-layout-sider-border);transition:var(--nuraly-layout-sider-transition)}:host([theme=light]) .nr-sider{background:var(--nuraly-layout-sider-light-background);color:var(--nuraly-layout-sider-light-text);border-right:1px solid var(--nuraly-layout-sider-light-border)}.nr-sider-children{flex:1;min-height:0;overflow:auto}.nr-sider-trigger{position:absolute;bottom:0;left:0;right:0;height:var(--nuraly-layout-trigger-height);display:flex;align-items:center;justify-content:center;background:var(--nuraly-layout-trigger-background);color:var(--nuraly-layout-trigger-text);cursor:pointer;transition:var(--nuraly-layout-transition);border-top:1px solid var(--nuraly-layout-trigger-border);border-radius:var(--nuraly-layout-trigger-border-radius)}:host([theme=light]) .nr-sider-trigger{background:var(--nuraly-layout-trigger-light-background);color:var(--nuraly-layout-trigger-light-text);border-top:1px solid var(--nuraly-layout-trigger-light-border)}.nr-sider-trigger:hover{background:var(--nuraly-layout-trigger-background-hover)}:host([theme=light]) .nr-sider-trigger:hover{background:var(--nuraly-layout-trigger-light-background-hover)}.nr-sider-zero-width-trigger{position:absolute;top:64px;right:calc(-1 * var(--nuraly-layout-zero-trigger-width));width:var(--nuraly-layout-zero-trigger-width);height:var(--nuraly-layout-zero-trigger-height);display:flex;align-items:center;justify-content:center;background:var(--nuraly-layout-zero-trigger-background);color:var(--nuraly-layout-zero-trigger-text);cursor:pointer;transition:var(--nuraly-layout-transition);border-radius:var(--nuraly-layout-zero-trigger-border-radius);box-shadow:var(--nuraly-layout-zero-trigger-shadow);z-index:1}:host([theme=light]) .nr-sider-zero-width-trigger{background:var(--nuraly-layout-zero-trigger-background);color:var(--nuraly-layout-zero-trigger-text)}.nr-sider-zero-width-trigger:hover{background:var(--nuraly-layout-zero-trigger-background-hover)}.trigger-icon{font-size:16px;line-height:1}.nr-sider-collapsed{overflow:hidden}.nr-sider-zero-width{width:0!important;min-width:0!important;flex:0 0 0!important}`,x={xs:480,sm:576,md:768,lg:992,xl:1200,xxl:1600};var m=function(r,t,e,i){for(var o,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,e):i,l=r.length-1;l>=0;l--)(o=r[l])&&(n=(a<3?o(n):a>3?o(t,e,n):o(t,e))||n);return a>3&&n&&Object.defineProperty(t,e,n),n};let k=class extends(l(t)){constructor(){super(...arguments),this.collapsed=!1,this.collapsedWidth=80,this.collapsible=!1,this.defaultCollapsed=!1,this.reverseArrow=!1,this.theme="dark",this.trigger="default",this.width=200,this.zeroWidthTriggerStyle="",this.belowBreakpoint=!1}connectedCallback(){super.connectedCallback(),this.defaultCollapsed&&!this.hasAttribute("collapsed")&&(this.collapsed=!0),this.breakpoint&&this.setupResizeObserver()}disconnectedCallback(){var r;super.disconnectedCallback(),null===(r=this.resizeObserver)||void 0===r||r.disconnect()}updated(r){var t;super.updated(r),r.has("breakpoint")&&(null===(t=this.resizeObserver)||void 0===t||t.disconnect(),this.breakpoint&&this.setupResizeObserver())}setupResizeObserver(){if(!this.breakpoint)return;const r=x[this.breakpoint];this.resizeObserver=new ResizeObserver((t=>{for(const e of t){const t=e.contentRect.width<r;t!==this.belowBreakpoint&&(this.belowBreakpoint=t,this.collapsible&&t!==this.collapsed&&(this.collapsed=t,this.dispatchCollapseEvent("responsive")),this.dispatchBreakpointEvent(t))}}));const t=this.closest("nr-layout")||document.body;this.resizeObserver.observe(t)}toggleCollapse(){this.collapsed=!this.collapsed,this.dispatchCollapseEvent("clickTrigger")}dispatchCollapseEvent(r){this.dispatchEvent(new CustomEvent("collapse",{detail:{collapsed:this.collapsed,type:r},bubbles:!0,composed:!0}))}dispatchBreakpointEvent(r){this.dispatchEvent(new CustomEvent("breakpoint",{detail:{broken:r},bubbles:!0,composed:!0}))}getCurrentWidth(){return this.collapsed?`${this.collapsedWidth}px`:"number"==typeof this.width?`${this.width}px`:this.width.toString()}renderTrigger(){if(null===this.trigger||!this.collapsible)return null;return this.querySelector('[slot="trigger"]')?e`<slot name="trigger"></slot>`:0===this.collapsedWidth&&this.collapsed?e`<div class="nr-sider-zero-width-trigger" part="trigger" style="${this.zeroWidthTriggerStyle}" @click="${this.toggleCollapse}"><span class="trigger-icon">${this.reverseArrow?"◀":"▶"}</span></div>`:e`<div class="nr-sider-trigger" part="trigger" @click="${this.toggleCollapse}"><span class="trigger-icon">${this.collapsed?this.reverseArrow?"◀":"▶":this.reverseArrow?"▶":"◀"}</span></div>`}render(){const r={"nr-sider":!0,"nr-sider-collapsed":this.collapsed,"nr-sider-has-trigger":this.collapsible&&null!==this.trigger,"nr-sider-below-breakpoint":this.belowBreakpoint,"nr-sider-zero-width":this.collapsed&&0===this.collapsedWidth};return e`<aside class="${s(r)}" part="sider" style="width:${this.getCurrentWidth()};flex:0 0 ${this.getCurrentWidth()}"><div class="nr-sider-children"><slot></slot></div>${this.renderTrigger()}</aside>`}};k.styles=f,m([i({type:String})],k.prototype,"breakpoint",void 0),m([i({type:Boolean,reflect:!0})],k.prototype,"collapsed",void 0),m([i({type:Number,attribute:"collapsed-width"})],k.prototype,"collapsedWidth",void 0),m([i({type:Boolean})],k.prototype,"collapsible",void 0),m([i({type:Boolean,attribute:"default-collapsed"})],k.prototype,"defaultCollapsed",void 0),m([i({type:Boolean,attribute:"reverse-arrow"})],k.prototype,"reverseArrow",void 0),m([i({type:String,reflect:!0})],k.prototype,"theme",void 0),m([i({type:String})],k.prototype,"trigger",void 0),m([i({type:String})],k.prototype,"width",void 0),m([i({type:String,attribute:"zero-width-trigger-style"})],k.prototype,"zeroWidthTriggerStyle",void 0),m([n()],k.prototype,"belowBreakpoint",void 0),k=m([a("nr-sider")],k);const w=r`:host{display:block;flex:auto;min-height:0}.nr-content{flex:auto;min-height:0;background:var(--nuraly-layout-content-background);color:var(--nuraly-layout-content-text);transition:var(--nuraly-layout-transition)}`;var z=function(r,t,e,i){for(var o,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,e):i,l=r.length-1;l>=0;l--)(o=r[l])&&(n=(a<3?o(n):a>3?o(t,e,n):o(t,e))||n);return a>3&&n&&Object.defineProperty(t,e,n),n};let j=class extends(l(t)){render(){return e`<main class="nr-content" part="content"><slot></slot></main>`}};j.styles=w,j=z([a("nr-content")],j);export{x as BREAKPOINT_VALUES,j as NrContentElement,b as NrFooterElement,y as NrHeaderElement,h as NrLayoutElement,k as NrSiderElement};
|
|
1
|
+
import{css as r,LitElement as t,html as e}from"lit";import{property as i,queryAssignedElements as o,customElement as a,state as n}from"lit/decorators.js";import{NuralyUIBaseMixin as l}from"@nuralyui/common/mixins";import{classMap as s}from"lit/directives/class-map.js";const d=r`
|
|
2
|
+
:host {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex: auto;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
min-height: 0;
|
|
7
|
+
background: var(--nuraly-layout-background);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
:host([has-sider]) {
|
|
11
|
+
flex-direction: row;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.nr-layout {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex: auto;
|
|
17
|
+
flex-direction: inherit;
|
|
18
|
+
min-height: 0;
|
|
19
|
+
width: 100%;
|
|
20
|
+
}
|
|
21
|
+
`;var u=function(r,t,e,i){for(var o,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,e):i,l=r.length-1;l>=0;l--)(o=r[l])&&(n=(a<3?o(n):a>3?o(t,e,n):o(t,e))||n);return a>3&&n&&Object.defineProperty(t,e,n),n};let h=class extends(l(t)){constructor(){super(...arguments),this.hasSider=!1}connectedCallback(){super.connectedCallback(),this.detectSider()}updated(r){super.updated(r),this.detectSider()}detectSider(){var r;const t=null===(r=this.shadowRoot)||void 0===r?void 0:r.querySelector("slot");if(t){const r=t.assignedElements().some((r=>"nr-sider"===r.tagName.toLowerCase()));this.hasSider!==r&&(this.hasSider=r)}}handleSlotChange(){this.detectSider()}render(){return e`
|
|
22
|
+
<div class="nr-layout" part="layout">
|
|
23
|
+
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
24
|
+
</div>
|
|
25
|
+
`}};h.styles=d,u([i({type:Boolean,reflect:!0,attribute:"has-sider"})],h.prototype,"hasSider",void 0),u([o({selector:"nr-sider"})],h.prototype,"connectedCallback",null),h=u([a("nr-layout")],h);const g=r`
|
|
26
|
+
:host {
|
|
27
|
+
display: block;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.nr-header {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
padding: var(--nuraly-layout-header-padding);
|
|
34
|
+
height: var(--nuraly-layout-header-height);
|
|
35
|
+
line-height: var(--nuraly-layout-header-height);
|
|
36
|
+
background: var(--nuraly-layout-header-background);
|
|
37
|
+
color: var(--nuraly-layout-header-text);
|
|
38
|
+
border-bottom: 1px solid var(--nuraly-layout-header-border);
|
|
39
|
+
transition: var(--nuraly-layout-transition);
|
|
40
|
+
}
|
|
41
|
+
`;var c=function(r,t,e,i){for(var o,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,e):i,l=r.length-1;l>=0;l--)(o=r[l])&&(n=(a<3?o(n):a>3?o(t,e,n):o(t,e))||n);return a>3&&n&&Object.defineProperty(t,e,n),n};let y=class extends(l(t)){constructor(){super(...arguments),this.height="64px"}render(){return e`
|
|
42
|
+
<header
|
|
43
|
+
class="nr-header"
|
|
44
|
+
part="header"
|
|
45
|
+
style="height: ${this.height}"
|
|
46
|
+
>
|
|
47
|
+
<slot></slot>
|
|
48
|
+
</header>
|
|
49
|
+
`}};y.styles=g,c([i({type:String})],y.prototype,"height",void 0),y=c([a("nr-header")],y);const p=r`
|
|
50
|
+
:host {
|
|
51
|
+
display: block;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.nr-footer {
|
|
55
|
+
padding: var(--nuraly-layout-footer-padding);
|
|
56
|
+
background: var(--nuraly-layout-footer-background);
|
|
57
|
+
color: var(--nuraly-layout-footer-text);
|
|
58
|
+
border-top: 1px solid var(--nuraly-layout-footer-border);
|
|
59
|
+
font-size: var(--nuraly-layout-font-size);
|
|
60
|
+
line-height: var(--nuraly-layout-line-height);
|
|
61
|
+
transition: var(--nuraly-layout-transition);
|
|
62
|
+
}
|
|
63
|
+
`;var v=function(r,t,e,i){for(var o,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,e):i,l=r.length-1;l>=0;l--)(o=r[l])&&(n=(a<3?o(n):a>3?o(t,e,n):o(t,e))||n);return a>3&&n&&Object.defineProperty(t,e,n),n};let b=class extends(l(t)){constructor(){super(...arguments),this.padding="24px 50px"}render(){return e`
|
|
64
|
+
<footer
|
|
65
|
+
class="nr-footer"
|
|
66
|
+
part="footer"
|
|
67
|
+
style="padding: ${this.padding}"
|
|
68
|
+
>
|
|
69
|
+
<slot></slot>
|
|
70
|
+
</footer>
|
|
71
|
+
`}};b.styles=p,v([i({type:String})],b.prototype,"padding",void 0),b=v([a("nr-footer")],b);const f=r`
|
|
72
|
+
:host {
|
|
73
|
+
display: block;
|
|
74
|
+
position: relative;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.nr-sider {
|
|
78
|
+
position: relative;
|
|
79
|
+
display: flex;
|
|
80
|
+
flex-direction: column;
|
|
81
|
+
min-width: 0;
|
|
82
|
+
background: var(--nuraly-layout-sider-background);
|
|
83
|
+
color: var(--nuraly-layout-sider-text);
|
|
84
|
+
border-right: 1px solid var(--nuraly-layout-sider-border);
|
|
85
|
+
transition: var(--nuraly-layout-sider-transition);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
:host([theme='light']) .nr-sider {
|
|
89
|
+
background: var(--nuraly-layout-sider-light-background);
|
|
90
|
+
color: var(--nuraly-layout-sider-light-text);
|
|
91
|
+
border-right: 1px solid var(--nuraly-layout-sider-light-border);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.nr-sider-children {
|
|
95
|
+
flex: 1;
|
|
96
|
+
min-height: 0;
|
|
97
|
+
overflow: auto;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.nr-sider-trigger {
|
|
101
|
+
position: absolute;
|
|
102
|
+
bottom: 0;
|
|
103
|
+
left: 0;
|
|
104
|
+
right: 0;
|
|
105
|
+
height: var(--nuraly-layout-trigger-height);
|
|
106
|
+
display: flex;
|
|
107
|
+
align-items: center;
|
|
108
|
+
justify-content: center;
|
|
109
|
+
background: var(--nuraly-layout-trigger-background);
|
|
110
|
+
color: var(--nuraly-layout-trigger-text);
|
|
111
|
+
cursor: pointer;
|
|
112
|
+
transition: var(--nuraly-layout-transition);
|
|
113
|
+
border-top: 1px solid var(--nuraly-layout-trigger-border);
|
|
114
|
+
border-radius: var(--nuraly-layout-trigger-border-radius);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
:host([theme='light']) .nr-sider-trigger {
|
|
118
|
+
background: var(--nuraly-layout-trigger-light-background);
|
|
119
|
+
color: var(--nuraly-layout-trigger-light-text);
|
|
120
|
+
border-top: 1px solid var(--nuraly-layout-trigger-light-border);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.nr-sider-trigger:hover {
|
|
124
|
+
background: var(--nuraly-layout-trigger-background-hover);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
:host([theme='light']) .nr-sider-trigger:hover {
|
|
128
|
+
background: var(--nuraly-layout-trigger-light-background-hover);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.nr-sider-zero-width-trigger {
|
|
132
|
+
position: absolute;
|
|
133
|
+
top: 64px;
|
|
134
|
+
right: calc(-1 * var(--nuraly-layout-zero-trigger-width));
|
|
135
|
+
width: var(--nuraly-layout-zero-trigger-width);
|
|
136
|
+
height: var(--nuraly-layout-zero-trigger-height);
|
|
137
|
+
display: flex;
|
|
138
|
+
align-items: center;
|
|
139
|
+
justify-content: center;
|
|
140
|
+
background: var(--nuraly-layout-zero-trigger-background);
|
|
141
|
+
color: var(--nuraly-layout-zero-trigger-text);
|
|
142
|
+
cursor: pointer;
|
|
143
|
+
transition: var(--nuraly-layout-transition);
|
|
144
|
+
border-radius: var(--nuraly-layout-zero-trigger-border-radius);
|
|
145
|
+
box-shadow: var(--nuraly-layout-zero-trigger-shadow);
|
|
146
|
+
z-index: 1;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
:host([theme='light']) .nr-sider-zero-width-trigger {
|
|
150
|
+
background: var(--nuraly-layout-zero-trigger-background);
|
|
151
|
+
color: var(--nuraly-layout-zero-trigger-text);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.nr-sider-zero-width-trigger:hover {
|
|
155
|
+
background: var(--nuraly-layout-zero-trigger-background-hover);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.trigger-icon {
|
|
159
|
+
font-size: 16px;
|
|
160
|
+
line-height: 1;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.nr-sider-collapsed {
|
|
164
|
+
overflow: hidden;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.nr-sider-zero-width {
|
|
168
|
+
width: 0 !important;
|
|
169
|
+
min-width: 0 !important;
|
|
170
|
+
flex: 0 0 0 !important;
|
|
171
|
+
}
|
|
172
|
+
`,x={xs:480,sm:576,md:768,lg:992,xl:1200,xxl:1600};var m=function(r,t,e,i){for(var o,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,e):i,l=r.length-1;l>=0;l--)(o=r[l])&&(n=(a<3?o(n):a>3?o(t,e,n):o(t,e))||n);return a>3&&n&&Object.defineProperty(t,e,n),n};let k=class extends(l(t)){constructor(){super(...arguments),this.collapsed=!1,this.collapsedWidth=80,this.collapsible=!1,this.defaultCollapsed=!1,this.reverseArrow=!1,this.theme="dark",this.trigger="default",this.width=200,this.zeroWidthTriggerStyle="",this.belowBreakpoint=!1}connectedCallback(){super.connectedCallback(),this.defaultCollapsed&&!this.hasAttribute("collapsed")&&(this.collapsed=!0),this.breakpoint&&this.setupResizeObserver()}disconnectedCallback(){var r;super.disconnectedCallback(),null===(r=this.resizeObserver)||void 0===r||r.disconnect()}updated(r){var t;super.updated(r),r.has("breakpoint")&&(null===(t=this.resizeObserver)||void 0===t||t.disconnect(),this.breakpoint&&this.setupResizeObserver())}setupResizeObserver(){if(!this.breakpoint)return;const r=x[this.breakpoint];this.resizeObserver=new ResizeObserver((t=>{for(const e of t){const t=e.contentRect.width<r;t!==this.belowBreakpoint&&(this.belowBreakpoint=t,this.collapsible&&t!==this.collapsed&&(this.collapsed=t,this.dispatchCollapseEvent("responsive")),this.dispatchBreakpointEvent(t))}}));const t=this.closest("nr-layout")||document.body;this.resizeObserver.observe(t)}toggleCollapse(){this.collapsed=!this.collapsed,this.dispatchCollapseEvent("clickTrigger")}dispatchCollapseEvent(r){this.dispatchEvent(new CustomEvent("collapse",{detail:{collapsed:this.collapsed,type:r},bubbles:!0,composed:!0}))}dispatchBreakpointEvent(r){this.dispatchEvent(new CustomEvent("breakpoint",{detail:{broken:r},bubbles:!0,composed:!0}))}getCurrentWidth(){return this.collapsed?`${this.collapsedWidth}px`:"number"==typeof this.width?`${this.width}px`:this.width.toString()}renderTrigger(){if(null===this.trigger||!this.collapsible)return null;return this.querySelector('[slot="trigger"]')?e`<slot name="trigger"></slot>`:0===this.collapsedWidth&&this.collapsed?e`
|
|
173
|
+
<div
|
|
174
|
+
class="nr-sider-zero-width-trigger"
|
|
175
|
+
part="trigger"
|
|
176
|
+
style=${this.zeroWidthTriggerStyle}
|
|
177
|
+
@click=${this.toggleCollapse}
|
|
178
|
+
>
|
|
179
|
+
<span class="trigger-icon">${this.reverseArrow?"◀":"▶"}</span>
|
|
180
|
+
</div>
|
|
181
|
+
`:e`
|
|
182
|
+
<div
|
|
183
|
+
class="nr-sider-trigger"
|
|
184
|
+
part="trigger"
|
|
185
|
+
@click=${this.toggleCollapse}
|
|
186
|
+
>
|
|
187
|
+
<span class="trigger-icon">
|
|
188
|
+
${this.collapsed?this.reverseArrow?"◀":"▶":this.reverseArrow?"▶":"◀"}
|
|
189
|
+
</span>
|
|
190
|
+
</div>
|
|
191
|
+
`}render(){const r={"nr-sider":!0,"nr-sider-collapsed":this.collapsed,"nr-sider-has-trigger":this.collapsible&&null!==this.trigger,"nr-sider-below-breakpoint":this.belowBreakpoint,"nr-sider-zero-width":this.collapsed&&0===this.collapsedWidth};return e`
|
|
192
|
+
<aside
|
|
193
|
+
class=${s(r)}
|
|
194
|
+
part="sider"
|
|
195
|
+
style="width: ${this.getCurrentWidth()}; flex: 0 0 ${this.getCurrentWidth()};"
|
|
196
|
+
>
|
|
197
|
+
<div class="nr-sider-children">
|
|
198
|
+
<slot></slot>
|
|
199
|
+
</div>
|
|
200
|
+
${this.renderTrigger()}
|
|
201
|
+
</aside>
|
|
202
|
+
`}};k.styles=f,m([i({type:String})],k.prototype,"breakpoint",void 0),m([i({type:Boolean,reflect:!0})],k.prototype,"collapsed",void 0),m([i({type:Number,attribute:"collapsed-width"})],k.prototype,"collapsedWidth",void 0),m([i({type:Boolean})],k.prototype,"collapsible",void 0),m([i({type:Boolean,attribute:"default-collapsed"})],k.prototype,"defaultCollapsed",void 0),m([i({type:Boolean,attribute:"reverse-arrow"})],k.prototype,"reverseArrow",void 0),m([i({type:String,reflect:!0})],k.prototype,"theme",void 0),m([i({type:String})],k.prototype,"trigger",void 0),m([i({type:String})],k.prototype,"width",void 0),m([i({type:String,attribute:"zero-width-trigger-style"})],k.prototype,"zeroWidthTriggerStyle",void 0),m([n()],k.prototype,"belowBreakpoint",void 0),k=m([a("nr-sider")],k);const w=r`
|
|
203
|
+
:host {
|
|
204
|
+
display: block;
|
|
205
|
+
flex: auto;
|
|
206
|
+
min-height: 0;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.nr-content {
|
|
210
|
+
flex: auto;
|
|
211
|
+
min-height: 0;
|
|
212
|
+
background: var(--nuraly-layout-content-background);
|
|
213
|
+
color: var(--nuraly-layout-content-text);
|
|
214
|
+
transition: var(--nuraly-layout-transition);
|
|
215
|
+
}
|
|
216
|
+
`;var z=function(r,t,e,i){for(var o,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,e):i,l=r.length-1;l>=0;l--)(o=r[l])&&(n=(a<3?o(n):a>3?o(t,e,n):o(t,e))||n);return a>3&&n&&Object.defineProperty(t,e,n),n};let j=class extends(l(t)){render(){return e`
|
|
217
|
+
<main class="nr-content" part="content">
|
|
218
|
+
<slot></slot>
|
|
219
|
+
</main>
|
|
220
|
+
`}};j.styles=w,j=z([a("nr-content")],j);export{x as BREAKPOINT_VALUES,j as NrContentElement,b as NrFooterElement,y as NrHeaderElement,h as NrLayoutElement,k as NrSiderElement};
|