@operato/layout 8.0.0-beta.0 → 8.0.0-beta.2

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,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
- });
@@ -1,41 +0,0 @@
1
- // import { playwrightLauncher } from '@web/test-runner-playwright';
2
-
3
- const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode'];
4
-
5
- export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
6
- /** Test files to run */
7
- files: 'dist/test/**/*.test.js',
8
-
9
- /** Resolve bare module imports */
10
- nodeResolve: {
11
- exportConditions: ['browser', 'development'],
12
- },
13
-
14
- /** Filter out lit dev mode logs */
15
- filterBrowserLogs(log) {
16
- for (const arg of log.args) {
17
- if (typeof arg === 'string' && filteredLogs.some(l => arg.includes(l))) {
18
- return false;
19
- }
20
- }
21
- return true;
22
- },
23
-
24
- /** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
25
- // esbuildTarget: 'auto',
26
-
27
- /** Amount of browsers to run concurrently */
28
- // concurrentBrowsers: 2,
29
-
30
- /** Amount of test files per browser to test concurrently */
31
- // concurrency: 1,
32
-
33
- /** Browsers to run tests on */
34
- // browsers: [
35
- // playwrightLauncher({ product: 'chromium' }),
36
- // playwrightLauncher({ product: 'firefox' }),
37
- // playwrightLauncher({ product: 'webkit' }),
38
- // ],
39
-
40
- // See documentation for all available options
41
- });