@operato/layout 8.0.0-alpha.51 → 8.0.0-beta.1

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.
@@ -1,108 +0,0 @@
1
- import '@operato/popup/ox-floating-overlay.js'
2
- import '../components/ox-resize-splitter.js'
3
-
4
- import { css, html, LitElement } from 'lit'
5
- import { ifDefined } from 'lit/directives/if-defined.js'
6
- import { customElement, property, state } from 'lit/decorators.js'
7
- import { connect } from 'pwa-helpers/connect-mixin.js'
8
-
9
- import { Viewpart, VIEWPART_LEVEL } from '../actions/layout.js'
10
- import store from '../initializer.js'
11
-
12
- @customElement('ox-header-bar')
13
- class HeaderBar extends connect(store)(LitElement) {
14
- static styles = [
15
- css`
16
- :host {
17
- display: flex;
18
- flex-flow: column nowrap;
19
- align-items: stretch;
20
-
21
- position: relative;
22
-
23
- background-color: var(--header-bar-background-color);
24
- }
25
-
26
- *[headerbar] {
27
- display: block;
28
- }
29
- `
30
- ]
31
-
32
- @property({ type: Boolean, attribute: 'fullbleed' }) fullbleed: boolean = false
33
-
34
- @state() viewparts: { [name: string]: Viewpart } = {}
35
-
36
- private _startHeight: number = 0
37
-
38
- render() {
39
- var viewparts = this.viewparts
40
- var headerbars = Object.keys(viewparts)
41
- .map(name => {
42
- return {
43
- name,
44
- ...viewparts[name]
45
- }
46
- })
47
- .filter(viewpart => viewpart.position == 'headerbar' && (!this.fullbleed || viewpart.hovering))
48
-
49
- headerbars = [
50
- ...headerbars.filter(viewpart => viewpart.level == VIEWPART_LEVEL.TOPMOST),
51
- ...headerbars.filter(viewpart => viewpart.level !== VIEWPART_LEVEL.TOPMOST)
52
- ]
53
-
54
- return html`
55
- ${headerbars.map(headerbar =>
56
- !headerbar.show
57
- ? html``
58
- : headerbar.hovering
59
- ? html`
60
- <ox-floating-overlay
61
- .backdrop=${headerbar.backdrop}
62
- direction="down"
63
- .hovering=${headerbar.hovering}
64
- .name=${headerbar.name}
65
- .title=${headerbar.title}
66
- .help=${headerbar.help}
67
- .size=${headerbar.size}
68
- .closable=${headerbar.closable}
69
- .templateProperties=${headerbar.templateProperties}
70
- .historical=${true}
71
- .search=${headerbar.search}
72
- .filter=${headerbar.filter}
73
- z-index=${ifDefined(headerbar.zIndex)}
74
- >${headerbar.template}</ox-floating-overlay
75
- >
76
- `
77
- : html`
78
- <div headerbar>${headerbar.template}</div>
79
- ${headerbar.resizable
80
- ? html`
81
- <ox-resize-splitter
82
- @splitter-dragstart=${(e: CustomEvent) => this.resizeStart(e)}
83
- @splitter-drag=${(e: CustomEvent) => this.resizeDrag(e)}
84
- ></ox-resize-splitter>
85
- `
86
- : html``}
87
- `
88
- )}
89
- `
90
- }
91
-
92
- resizeStart(e: CustomEvent) {
93
- this._startHeight = ((e.target as HTMLElement)?.previousElementSibling as HTMLElement).offsetHeight
94
- }
95
-
96
- resizeDrag(e: CustomEvent) {
97
- var delta = e.detail
98
-
99
- var x = ((e.target as HTMLElement)?.previousElementSibling as HTMLElement).children
100
- Array.from(x).forEach(ele => {
101
- ;(ele as HTMLElement).style.height = `${this._startHeight + delta.y}px`
102
- })
103
- }
104
-
105
- stateChanged(state: any) {
106
- this.viewparts = state.layout.viewparts || {}
107
- }
108
- }
@@ -1,113 +0,0 @@
1
- import '@operato/popup/ox-floating-overlay.js'
2
- import '../components/ox-resize-splitter.js'
3
-
4
- import { css, html, LitElement } from 'lit'
5
- import { ifDefined } from 'lit/directives/if-defined.js'
6
- import { customElement, property, state } from 'lit/decorators.js'
7
- import { connect } from 'pwa-helpers/connect-mixin.js'
8
-
9
- import { ScrollbarStyles } from '@operato/styles'
10
-
11
- import { Viewpart, VIEWPART_LEVEL } from '../actions/layout.js'
12
- import store from '../initializer.js'
13
-
14
- @customElement('ox-nav-bar')
15
- class NavBar extends connect(store)(LitElement) {
16
- static styles = [
17
- ScrollbarStyles,
18
- css`
19
- :host {
20
- display: flex;
21
- flex-flow: row nowrap;
22
- align-items: stretch;
23
-
24
- position: relative;
25
-
26
- background-color: var(--nav-bar-background-color);
27
- }
28
-
29
- *[navbar] {
30
- display: flex;
31
- flex-direction: row;
32
- }
33
- `
34
- ]
35
-
36
- @property({ type: Boolean, attribute: 'fullbleed' }) fullbleed: boolean = false
37
-
38
- @state() viewparts: { [name: string]: Viewpart } = {}
39
-
40
- private _startWidth: number = 0
41
-
42
- render() {
43
- var viewparts = this.viewparts
44
- var navbars = Object.keys(viewparts)
45
- .map(name => {
46
- return {
47
- name,
48
- ...viewparts[name]
49
- }
50
- })
51
- .filter(viewpart => viewpart.position == 'navbar' && (!this.fullbleed || viewpart.hovering))
52
-
53
- navbars = [
54
- ...navbars.filter(viewpart => viewpart.level == VIEWPART_LEVEL.TOPMOST),
55
- ...navbars.filter(viewpart => viewpart.level !== VIEWPART_LEVEL.TOPMOST)
56
- ]
57
-
58
- return html`
59
- ${navbars.map(navbar =>
60
- !navbar.show
61
- ? html``
62
- : navbar.hovering
63
- ? html`
64
- <ox-floating-overlay
65
- .backdrop=${navbar.backdrop}
66
- direction="right"
67
- .hovering=${navbar.hovering}
68
- .name=${navbar.name}
69
- .title=${navbar.title}
70
- .help=${navbar.help}
71
- .size=${navbar.size}
72
- .closable=${navbar.closable}
73
- .templateProperties=${navbar.templateProperties}
74
- .historical=${true}
75
- .search=${navbar.search}
76
- .filter=${navbar.filter}
77
- z-index=${ifDefined(navbar.zIndex)}
78
- >${navbar.template}</ox-floating-overlay
79
- >
80
- `
81
- : html`
82
- <div navbar>${navbar.template}</div>
83
- ${navbar.resizable
84
- ? html`
85
- <ox-resize-splitter
86
- @splitter-dragstart=${(e: CustomEvent) => this.resizeStart(e)}
87
- @splitter-drag=${(e: CustomEvent) => this.resizeDrag(e)}
88
- vertical
89
- ></ox-resize-splitter>
90
- `
91
- : html``}
92
- `
93
- )}
94
- `
95
- }
96
-
97
- resizeStart(e: CustomEvent) {
98
- this._startWidth = ((e.target as HTMLElement)?.previousElementSibling as HTMLElement).offsetWidth
99
- }
100
-
101
- resizeDrag(e: CustomEvent) {
102
- var delta = e.detail
103
-
104
- var x = ((e.target as HTMLElement)?.previousElementSibling as HTMLElement).children
105
- Array.from(x).forEach(ele => {
106
- ;(ele as HTMLElement).style.width = `${this._startWidth + delta.x}px`
107
- })
108
- }
109
-
110
- stateChanged(state: any) {
111
- this.viewparts = state.layout.viewparts || {}
112
- }
113
- }
@@ -1,112 +0,0 @@
1
- import '@operato/popup/ox-floating-overlay.js'
2
- import '../components/ox-resize-splitter.js'
3
-
4
- import { css, html, LitElement } from 'lit'
5
- import { ifDefined } from 'lit/directives/if-defined.js'
6
- import { customElement, property, state } from 'lit/decorators.js'
7
- import { connect } from 'pwa-helpers/connect-mixin.js'
8
-
9
- import { Viewpart, VIEWPART_LEVEL } from '../actions/layout.js'
10
- import store from '../initializer.js'
11
-
12
- @customElement('ox-page-footer-bar')
13
- class PageFooterBar extends connect(store)(LitElement) {
14
- static styles = [
15
- css`
16
- :host {
17
- display: flex;
18
- flex-flow: column-reverse nowrap;
19
- align-items: stretch;
20
- position: relative;
21
- }
22
-
23
- *[footerbar] {
24
- display: block;
25
- max-width: 100vw;
26
- }
27
-
28
- @media screen and (max-width: 460px) {
29
- :host {
30
- padding-bottom: 0;
31
- }
32
- }
33
- `
34
- ]
35
-
36
- @property({ type: Boolean, attribute: 'fullbleed' }) fullbleed: boolean = false
37
-
38
- @state() viewparts: { [name: string]: Viewpart } = {}
39
-
40
- private _startHeight: number = 0
41
-
42
- render() {
43
- var viewparts = this.viewparts
44
- var footerbars = Object.keys(viewparts)
45
- .map(name => {
46
- return {
47
- name,
48
- ...viewparts[name]
49
- }
50
- })
51
- .filter(viewpart => viewpart.position == 'page-footerbar' && (!this.fullbleed || viewpart.hovering))
52
-
53
- footerbars = [
54
- ...footerbars.filter(viewpart => viewpart.level == VIEWPART_LEVEL.TOPMOST),
55
- ...footerbars.filter(viewpart => viewpart.level !== VIEWPART_LEVEL.TOPMOST)
56
- ]
57
-
58
- return html`
59
- ${footerbars.map(footerbar =>
60
- !footerbar.show
61
- ? html``
62
- : footerbar.hovering
63
- ? html`
64
- <ox-floating-overlay
65
- .backdrop=${footerbar.backdrop}
66
- direction="up"
67
- .hovering=${footerbar.hovering}
68
- .name=${footerbar.name}
69
- .title=${footerbar.title || ''}
70
- .help=${footerbar.help}
71
- .size=${footerbar.size}
72
- .closable=${footerbar.closable}
73
- .templateProperties=${footerbar.templateProperties}
74
- .historical=${true}
75
- .search=${footerbar.search}
76
- .filter=${footerbar.filter}
77
- z-index=${ifDefined(footerbar.zIndex)}
78
- >${footerbar.template}</ox-floating-overlay
79
- >
80
- `
81
- : html`
82
- <div footerbar>${footerbar.template}</div>
83
- ${footerbar.resizable
84
- ? html`
85
- <ox-resize-splitter
86
- @splitter-dragstart=${(e: CustomEvent) => this.resizeStart(e)}
87
- @splitter-drag=${(e: CustomEvent) => this.resizeDrag(e)}
88
- ></ox-resize-splitter>
89
- `
90
- : html``}
91
- `
92
- )}
93
- `
94
- }
95
-
96
- resizeStart(e: CustomEvent) {
97
- this._startHeight = ((e.target as HTMLElement)?.previousElementSibling as HTMLElement).offsetHeight
98
- }
99
-
100
- resizeDrag(e: CustomEvent) {
101
- var delta = e.detail
102
-
103
- var x = ((e.target as HTMLElement)?.previousElementSibling as HTMLElement).children
104
- Array.from(x).forEach(ele => {
105
- ;(ele as HTMLElement).style.height = `${this._startHeight - delta.y}px`
106
- })
107
- }
108
-
109
- stateChanged(state: any) {
110
- this.viewparts = state.layout.viewparts || {}
111
- }
112
- }
@@ -1,106 +0,0 @@
1
- import '@operato/popup/ox-floating-overlay.js'
2
- import '../components/ox-resize-splitter.js'
3
-
4
- import { css, html, LitElement } from 'lit'
5
- import { ifDefined } from 'lit/directives/if-defined.js'
6
- import { customElement, property, state } from 'lit/decorators.js'
7
- import { connect } from 'pwa-helpers/connect-mixin.js'
8
-
9
- import { Viewpart, VIEWPART_LEVEL } from '../actions/layout.js'
10
- import store from '../initializer.js'
11
-
12
- @customElement('ox-page-header-bar')
13
- class PageHeaderBar extends connect(store)(LitElement) {
14
- static styles = [
15
- css`
16
- :host {
17
- display: flex;
18
- flex-flow: column nowrap;
19
- align-items: stretch;
20
-
21
- position: relative;
22
- }
23
-
24
- *[headerbar] {
25
- display: block;
26
- }
27
- `
28
- ]
29
-
30
- @property({ type: Boolean, attribute: 'fullbleed' }) fullbleed: boolean = false
31
-
32
- @state() viewparts: { [name: string]: Viewpart } = {}
33
-
34
- private _startHeight: number = 0
35
-
36
- render() {
37
- var viewparts = this.viewparts
38
- var headerbars = Object.keys(viewparts)
39
- .map(name => {
40
- return {
41
- name,
42
- ...viewparts[name]
43
- }
44
- })
45
- .filter(viewpart => viewpart.position == 'page-headerbar' && (!this.fullbleed || viewpart.hovering))
46
-
47
- headerbars = [
48
- ...headerbars.filter(viewpart => viewpart.level == VIEWPART_LEVEL.TOPMOST),
49
- ...headerbars.filter(viewpart => viewpart.level !== VIEWPART_LEVEL.TOPMOST)
50
- ]
51
-
52
- return html`
53
- ${headerbars.map(headerbar =>
54
- !headerbar.show
55
- ? html``
56
- : headerbar.hovering
57
- ? html`
58
- <ox-floating-overlay
59
- .backdrop=${headerbar.backdrop}
60
- direction="down"
61
- .hovering=${headerbar.hovering}
62
- .name=${headerbar.name}
63
- .title=${headerbar.title || ''}
64
- .help=${headerbar.help}
65
- .size=${headerbar.size}
66
- .closable=${headerbar.closable}
67
- .templateProperties=${headerbar.templateProperties}
68
- .historical=${true}
69
- .search=${headerbar.search}
70
- .filter=${headerbar.filter}
71
- z-index=${ifDefined(headerbar.zIndex)}
72
- >${headerbar.template}</ox-floating-overlay
73
- >
74
- `
75
- : html`
76
- <div headerbar>${headerbar.template}</div>
77
- ${headerbar.resizable
78
- ? html`
79
- <ox-resize-splitter
80
- @splitter-dragstart=${(e: CustomEvent) => this.resizeStart(e)}
81
- @splitter-drag=${(e: CustomEvent) => this.resizeDrag(e)}
82
- ></ox-resize-splitter>
83
- `
84
- : html``}
85
- `
86
- )}
87
- `
88
- }
89
-
90
- resizeStart(e: CustomEvent) {
91
- this._startHeight = ((e.target as HTMLElement)?.previousElementSibling as HTMLElement).offsetHeight
92
- }
93
-
94
- resizeDrag(e: CustomEvent) {
95
- var delta = e.detail
96
-
97
- var x = ((e.target as HTMLElement)?.previousElementSibling as HTMLElement).children
98
- Array.from(x).forEach(ele => {
99
- ;(ele as HTMLElement).style.height = `${this._startHeight + delta.y}px`
100
- })
101
- }
102
-
103
- stateChanged(state: any) {
104
- this.viewparts = state.layout.viewparts || {}
105
- }
106
- }
@@ -1,109 +0,0 @@
1
- import '@material/web/button/filled-button.js'
2
- import '@material/web/icon/icon.js'
3
-
4
- import { css, html, LitElement } from 'lit'
5
- import { customElement, property } from 'lit/decorators.js'
6
- import { connect } from 'pwa-helpers/connect-mixin.js'
7
-
8
- import { CLOSE_SNACKBAR } from '../actions/snackbar'
9
- import store from '../initializer.js'
10
-
11
- @customElement('ox-snack-bar')
12
- class SnackBar extends connect(store)(LitElement) {
13
- static styles = css`
14
- :host {
15
- display: block;
16
- position: fixed;
17
- top: 100%;
18
- left: 0;
19
- right: 0;
20
- padding: 12px;
21
- color: var(--md-sys-color-inverse-on-surface, white);
22
- background-color: var(--md-sys-color-inverse-surface, black);
23
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
24
- text-align: center;
25
- will-change: transform;
26
- transform: translate3d(0, 0, 0);
27
- transition-property: visibility, transform;
28
- transition-duration: 0.2s;
29
- visibility: hidden;
30
- }
31
-
32
- md-filled-button {
33
- margin-top: var(--spacing-medium);
34
- text-transform: capitalize;
35
- }
36
-
37
- :host([active]) {
38
- visibility: visible;
39
- transform: translate3d(0, -100%, 0);
40
- }
41
-
42
- md-icon {
43
- vertical-align: middle;
44
- max-width: 20px;
45
- --md-icon-size: 1.5em;
46
- }
47
-
48
- .info {
49
- color: var(--status-info-color);
50
- }
51
-
52
- .warn {
53
- color: var(--status-warning-color);
54
- }
55
-
56
- .error {
57
- color: var(--status-danger-color);
58
- }
59
-
60
- @media (min-width: 460px) {
61
- :host {
62
- width: 320px;
63
- margin: auto;
64
- }
65
- }
66
- `
67
-
68
- @property({ type: String }) level: 'info' | 'warn' | 'error' = 'info'
69
- @property({ type: String }) message: string = ''
70
- @property({ type: Boolean, reflect: true }) active: boolean = false
71
- @property({ type: Object }) action: any
72
-
73
- render() {
74
- return html`
75
- <span>
76
- <md-icon class=${this.level}
77
- >${this.level == 'info'
78
- ? html` notification_important `
79
- : this.level == 'warn'
80
- ? html` warning `
81
- : this.level == 'error'
82
- ? html` error `
83
- : html``}</md-icon
84
- >
85
- </span>
86
- <span>${this.message}</span>
87
- ${this.action && this.action.label
88
- ? html`
89
- <md-filled-button
90
- @click=${() => {
91
- store.dispatch({ type: CLOSE_SNACKBAR })
92
- this.action.callback()
93
- }}
94
- >${this.action.label}</md-filled-button
95
- >
96
- `
97
- : html``}
98
- `
99
- }
100
-
101
- stateChanged(state: any) {
102
- var { level, message, snackbarOpened, action } = state.snackbar || {}
103
-
104
- this.level = level
105
- this.message = message
106
- this.active = snackbarOpened
107
- this.action = action
108
- }
109
- }
@@ -1,72 +0,0 @@
1
- import { APPEND_VIEWPART, REMOVE_VIEWPART, UPDATE_VIEWPART, UPDATE_VIEWPORT_WIDTH, Viewpart } from '../actions/layout'
2
-
3
- const INITIAL_STATE: {
4
- viewparts: { [name: string]: Viewpart }
5
- width: 'WIDE' | 'NARROW'
6
- } = {
7
- viewparts: {},
8
- width: 'WIDE'
9
- }
10
-
11
- const layout = (state = INITIAL_STATE, action: any) => {
12
- let viewparts = { ...state.viewparts }
13
-
14
- switch (action.type) {
15
- case APPEND_VIEWPART:
16
- return {
17
- ...state,
18
- viewparts: {
19
- ...state.viewparts,
20
- [action.name]: {
21
- ...action.viewpart,
22
- position: action.position
23
- }
24
- }
25
- }
26
-
27
- case REMOVE_VIEWPART:
28
- delete viewparts[action.name]
29
- return {
30
- ...state,
31
- viewparts
32
- }
33
-
34
- case UPDATE_VIEWPART:
35
- let viewpart = viewparts[action.name]
36
- if (!viewpart) {
37
- return state
38
- }
39
- let override = action.override || {}
40
-
41
- if (viewpart.temporary && override.show === false) {
42
- /* temporary viewpart는 show=false가 될 때, 제거되어야 한다. */
43
- delete viewparts[action.name]
44
- return {
45
- ...state,
46
- viewparts
47
- }
48
- } else {
49
- return {
50
- ...state,
51
- viewparts: {
52
- ...state.viewparts,
53
- [action.name]: {
54
- ...viewpart,
55
- ...action.override
56
- }
57
- }
58
- }
59
- }
60
-
61
- case UPDATE_VIEWPORT_WIDTH:
62
- return {
63
- ...state,
64
- width: action.width
65
- }
66
-
67
- default:
68
- return state
69
- }
70
- }
71
-
72
- export default layout
@@ -1,32 +0,0 @@
1
- import { CLOSE_SNACKBAR, OPEN_SNACKBAR, SnackbarAction } from '../actions/snackbar.js'
2
-
3
- const INITIAL_STATE = {
4
- snackbarOpened: false,
5
- level: '',
6
- message: '',
7
- action: {}
8
- }
9
-
10
- const snackbar = (state = INITIAL_STATE, action: SnackbarAction) => {
11
- switch (action.type) {
12
- case OPEN_SNACKBAR:
13
- return {
14
- ...state,
15
- snackbarOpened: true,
16
- level: action.level || 'info',
17
- message: action.message,
18
- action: {
19
- ...action.action
20
- }
21
- }
22
- case CLOSE_SNACKBAR:
23
- return {
24
- ...state,
25
- snackbarOpened: false
26
- }
27
- default:
28
- return state
29
- }
30
- }
31
-
32
- export default snackbar
package/tsconfig.json DELETED
@@ -1,24 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es2018",
4
- "module": "esnext",
5
- "moduleResolution": "node",
6
- "noEmitOnError": true,
7
- "lib": ["es2017", "dom"],
8
- "strict": true,
9
- "esModuleInterop": false,
10
- "allowSyntheticDefaultImports": true,
11
- "experimentalDecorators": true,
12
- "useDefineForClassFields": false,
13
- "importHelpers": true,
14
- "outDir": "dist",
15
- "sourceMap": true,
16
- "inlineSources": true,
17
- "rootDir": "./",
18
- "declaration": true,
19
- "incremental": true,
20
- "skipLibCheck": true,
21
- "types": ["node", "mocha"]
22
- },
23
- "include": ["**/*.ts"]
24
- }
@@ -1,27 +0,0 @@
1
- // import { hmrPlugin, presets } from '@open-wc/dev-server-hmr';
2
-
3
- /** Use Hot Module replacement by adding --hmr to the start command */
4
- const hmr = process.argv.includes('--hmr');
5
-
6
- export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
7
- open: '/demo/',
8
- /** Use regular watch mode if HMR is not enabled. */
9
- watch: !hmr,
10
- /** Resolve bare module imports */
11
- nodeResolve: {
12
- exportConditions: ['browser', 'development'],
13
- },
14
-
15
- /** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
16
- // esbuildTarget: 'auto'
17
-
18
- /** Set appIndex to enable SPA routing */
19
- // appIndex: 'demo/index.html',
20
-
21
- plugins: [
22
- /** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */
23
- // hmr && hmrPlugin({ exclude: ['**/*/node_modules/**/*'], presets: [presets.litElement] }),
24
- ],
25
-
26
- // See documentation for all available options
27
- });