@things-factory/context-ui 8.0.0-beta.1 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/context-ui",
3
- "version": "8.0.0-beta.1",
3
+ "version": "8.0.0-beta.2",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -30,7 +30,7 @@
30
30
  "@material/web": "^2.0.0",
31
31
  "@operato/context": "^8.0.0-beta",
32
32
  "@operato/layout": "^8.0.0-beta",
33
- "@things-factory/apptool-base": "^8.0.0-beta.1"
33
+ "@things-factory/apptool-base": "^8.0.0-beta.2"
34
34
  },
35
- "gitHead": "36c494e587640c1490318ef7b95adab02606e0c2"
35
+ "gitHead": "f03431a09435511b2595515658f9cb8f78ba4ebb"
36
36
  }
@@ -1,2 +0,0 @@
1
- export const APPEND_CONTEXT_TOOL = 'APPEND_CONTEXT_TOOL'
2
- export const REMOVE_CONTEXT_TOOL = 'REMOVE_CONTEXT_TOOL'
@@ -1,9 +0,0 @@
1
- import { store } from '@operato/shell'
2
-
3
- import context from './reducers/context'
4
-
5
- export default function bootstrap() {
6
- store.addReducers({
7
- context
8
- })
9
- }
package/client/index.ts DELETED
@@ -1,111 +0,0 @@
1
- export * from './actions/context'
2
-
3
- import '@operato/context/ox-title-bar.js'
4
- import '@operato/context/ox-page-title-bar.js'
5
- import '@operato/context/ox-page-action-context-bar.js'
6
- import '@operato/context/ox-context-toolbar.js'
7
-
8
- import { html } from 'lit-html'
9
-
10
- import { store, clientSettingStore } from '@operato/shell'
11
- import { appendViewpart, TOOL_POSITION, VIEWPART_POSITION } from '@operato/layout'
12
- import { isMobileDevice } from '@operato/utils'
13
-
14
- import {
15
- APPEND_APP_TOOL,
16
- APPEND_PAGE_TOOL,
17
- REMOVE_APP_TOOL,
18
- REMOVE_PAGE_TOOL
19
- } from '@things-factory/apptool-base/client'
20
- import { APPEND_CONTEXT_TOOL } from './actions/context.js'
21
-
22
- export async function setupContextUIPart({
23
- titlebar = 'header',
24
- contextToolbar = 'page-footer'
25
- }: {
26
- titlebar?: 'header' | 'page-header'
27
- contextToolbar?: 'footer' | 'page-header' | 'page-footer'
28
- }) {
29
- if (!isMobileDevice()) {
30
- const show = ((await clientSettingStore.get('title-on-page-header'))?.value || {}).show
31
- if (show) {
32
- titlebar = 'page-header'
33
- }
34
- }
35
-
36
- if (titlebar) {
37
- if (titlebar == 'page-header') {
38
- store.dispatch({
39
- type: REMOVE_APP_TOOL,
40
- name: 'title-bar'
41
- })
42
-
43
- store.dispatch({
44
- type: APPEND_PAGE_TOOL,
45
- tool: {
46
- name: 'title-bar',
47
- template: html` <ox-page-title-bar></ox-page-title-bar> `,
48
- position: TOOL_POSITION.CENTER
49
- }
50
- })
51
- } else {
52
- store.dispatch({
53
- type: REMOVE_PAGE_TOOL,
54
- name: 'title-bar'
55
- })
56
-
57
- /* add title app-tool */
58
- store.dispatch({
59
- type: APPEND_APP_TOOL,
60
- tool: {
61
- name: 'title-bar',
62
- template: html` <ox-title-bar></ox-title-bar> `,
63
- position: TOOL_POSITION.CENTER
64
- }
65
- })
66
- }
67
- }
68
-
69
- /*
70
- * footerbar 에 append 하는 순서가 중요하다.
71
- * footerbar는 아래에서 위로 올라가는 stack 형태의 순서이므로,
72
- * context-toolbar가 먼저, 그리고 context-toolbar-overlay 가 나중에 올라간다.
73
- */
74
- if (contextToolbar) {
75
- const position =
76
- contextToolbar == 'footer'
77
- ? VIEWPART_POSITION.FOOTERBAR
78
- : contextToolbar == 'page-header'
79
- ? VIEWPART_POSITION.PAGE_HEADERBAR
80
- : VIEWPART_POSITION.PAGE_FOOTERBAR
81
-
82
- appendViewpart({
83
- name: 'context-toolbar',
84
- viewpart: {
85
- show: true,
86
- template: html` <ox-context-toolbar></ox-context-toolbar> `
87
- },
88
- position
89
- })
90
-
91
- appendViewpart({
92
- name: 'context-toolbar-overlay',
93
- viewpart: {
94
- show: false,
95
- hovering: 'next',
96
- backdrop: true,
97
- template: html``
98
- },
99
- position
100
- })
101
-
102
- store.dispatch({
103
- type: APPEND_CONTEXT_TOOL,
104
- tool: {
105
- template: html` <ox-page-action-context-bar></ox-page-action-context-bar> `,
106
- position: TOOL_POSITION.CENTER,
107
- context: 'actions'
108
- }
109
- })
110
- }
111
- }
@@ -1,26 +0,0 @@
1
- import { APPEND_CONTEXT_TOOL, REMOVE_CONTEXT_TOOL } from '../actions/context'
2
-
3
- const INITIAL_STATE = {
4
- tools: []
5
- }
6
-
7
- const context = (state = INITIAL_STATE, action) => {
8
- switch (action.type) {
9
- case APPEND_CONTEXT_TOOL:
10
- return {
11
- ...state,
12
- tools: [...state.tools, action.tool]
13
- }
14
-
15
- case REMOVE_CONTEXT_TOOL:
16
- return {
17
- ...state,
18
- tools: state.tools.filter(i => i !== action.tool)
19
- }
20
-
21
- default:
22
- return state
23
- }
24
- }
25
-
26
- export default context
@@ -1,74 +0,0 @@
1
- body {
2
- --context-toolbar-background-color: var(--md-sys-color-background);
3
- --context-toolbar-button-background-color: #fff;
4
- --context-toolbar-border: 1px solid rgba(57, 78, 100, 0.5);
5
- --context-toolbar-border-hover: 1px solid var(--md-sys-color-primary);
6
- --context-toolbar-button-max-width: auto;
7
- --context-toolbar-button-height: 36px;
8
- --context-toolbar-button-margin: var(--margin-narrow) 0 var(--margin-wide) 0;
9
- --context-toolbar-button-padding: 0 9px;
10
- --context-toolbar-button: normal 13px var(--theme-font);
11
- --context-toolbar-button-color: var(--md-sys-color-secondary);
12
- --context-toolbar-iconbutton-color: var(--primary-text-color);
13
- --context-toolbar-iconbutton-size: 16px;
14
- --context-toolbar-function-button-height: 34px;
15
- --context-toolbar-function-button-radius: 5px;
16
- --context-toolbar-function-button-background-color: #446281;
17
- --context-toolbar-function-button-hover-background-color: var(--md-sys-color-primary);
18
- --context-toolbar-function-iconbutton-size: 28px;
19
- --context-toolbar-function-iconbutton-color: var(--primary-background-color);
20
- --context-toolbar-function-button-lineheight: 36px;
21
- --context-toolbar-function-button-color: #fff;
22
- --context-toolbar-function-button-padding: 0 10px;
23
- --context-toolbar-function-button-border: 1px solid rgba(0, 0, 0, 0.1);
24
- --context-toolbar-list-background-color: var(--primary-background-color);
25
- --context-toolbar-list-text: bold 18px var(--theme-font);
26
- --context-toolbar-list-icon-size: var(--icon-default-size);
27
- --context-toolbar-side-padding: 15px;
28
- --context-toolbar-shadow-line: none;
29
- --context-toolbar-title: bold 19px var(--theme-font);
30
-
31
- --context-ui-background-color: rgba(40, 54, 68, 0.9);
32
- --context-ui-box-shadow: 2px 2px 3px 0px rgba(0, 0, 0, 0.2);
33
- --context-ui-border-radius: 10px;
34
- --context-ui-padding: 10px;
35
- --context-ui-list-color: #d0fdee;
36
- --context-ui-list-border-bottom: 1px solid rgba(0, 0, 0, 0.3);
37
- --context-ui-list-border-hover-bottom: 1px solid var(--md-sys-color-primary);
38
- --context-ui-list-padding: 5px;
39
- --context-ui-button-color: var(--secondary-text-color);
40
- --context-ui-button-hover-color: #fff;
41
- --context-ui-button-background-color: #fff;
42
- --context-ui-button-background-hover-color: var(--md-sys-color-primary);
43
-
44
- --context-action-bar-button-margin: var(--margin-narrow) 0 var(--margin-wide) var(--margin-narrow);
45
- --context-action-bar-more-button-background-color: var(--context-ui-background-color);
46
- --context-action-bar-more-button-padding: 6px var(--padding-default);
47
- --context-action-bar-more-button-color: var(--md-sys-color-on-primary);
48
- --context-action-bar-more-button-border-radius: 4px;
49
- }
50
-
51
- @media only screen and (max-width: 460px) {
52
- body {
53
- --context-toolbar-button: normal 9px var(--theme-font);
54
- --context-toolbar-button-max-width: 60px;
55
- --context-toolbar-button-height: 50px;
56
- --context-toolbar-iconbutton-size: 30px;
57
- --context-toolbar-border: none;
58
- --context-toolbar-border-hover: none;
59
- --context-toolbar-iconbutton-display: block;
60
- --context-toolbar-iconbutton-margin: -2px;
61
- --context-toolbar-button-background-color: transparent;
62
- --context-toolbar-button-margin: 0;
63
- --context-toolbar-function-button-height: 34px;
64
- --context-toolbar-function-button-lineheight: 34px;
65
- --context-toolbar-function-button-radius: 0;
66
- --context-toolbar-side-padding: 0;
67
- --context-toolbar-shadow-line: inset 0px 2px 2px 0px rgba(0, 0, 0, 0.1);
68
- --context-toolbar-button-padding: 0 10px 0 0;
69
-
70
- --context-action-bar-button-margin: 0;
71
- --context-action-bar-more-button-border-radius: 0;
72
- --context-action-bar-more-button-padding: 6px var(--padding-wide);
73
- }
74
- }
@@ -1,68 +0,0 @@
1
- import '@operato/i18n/ox-i18n.js'
2
- import '@material/web/checkbox/checkbox.js'
3
-
4
- import { css, html, LitElement } from 'lit'
5
- import { customElement, property } from 'lit/decorators.js'
6
-
7
- import { i18next, localize } from '@operato/i18n'
8
- import { clientSettingStore } from '@operato/shell'
9
- import { setupContextUIPart } from './index'
10
-
11
- @customElement('title-on-page-header-setting-let')
12
- export class TitleOnPageHeaderSettingLet extends localize(i18next)(LitElement) {
13
- static styles = [
14
- css`
15
- label {
16
- display: flex;
17
- gap: 10px;
18
- align-items: center;
19
-
20
- font: var(--label-font);
21
- color: var(--md-sys-color-on-primary-container);
22
- text-transform: var(--label-text-transform);
23
- }
24
- `
25
- ]
26
-
27
- @property({ type: Boolean }) show: boolean = false
28
-
29
- render() {
30
- const checked = this.show === true
31
-
32
- return html`
33
- <setting-let>
34
- <ox-i18n slot="title" msgid="title.title-on-page-header setting"></ox-i18n>
35
-
36
- <div slot="content">
37
- <label>
38
- <md-checkbox @change=${e => this.onChangeContextOnPage(e)} ?checked=${checked}></md-checkbox>
39
- ${i18next.t('label.show-title-on-page-header')}
40
- </label>
41
- </div>
42
- </setting-let>
43
- `
44
- }
45
-
46
- async firstUpdated() {
47
- this.show = ((await clientSettingStore.get('title-on-page-header'))?.value || {}).show
48
- }
49
-
50
- async onChangeContextOnPage(e) {
51
- const show = e.currentTarget.checked
52
-
53
- try {
54
- await clientSettingStore.put({
55
- key: 'title-on-page-header',
56
- value: {
57
- show
58
- }
59
- })
60
- } catch (e) {
61
- console.error(e)
62
- }
63
-
64
- setupContextUIPart({
65
- titlebar: show ? 'page-header' : 'header'
66
- })
67
- }
68
- }
package/server/index.ts DELETED
File without changes