@operato/context 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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,24 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [8.0.0-beta.2](https://github.com/hatiolab/operato/compare/v8.0.0-beta.1...v8.0.0-beta.2) (2025-01-08)
7
+
8
+
9
+ ### :bug: Bug Fix
10
+
11
+ * typo .npmignore ([d9c0c8c](https://github.com/hatiolab/operato/commit/d9c0c8c79abc688c3c2cfb6c37fcb689483a5977))
12
+
13
+
14
+
15
+ ## [8.0.0-beta.1](https://github.com/hatiolab/operato/compare/v8.0.0-beta.0...v8.0.0-beta.1) (2025-01-08)
16
+
17
+
18
+ ### :bug: Bug Fix
19
+
20
+ * missing .npmignore ([be05985](https://github.com/hatiolab/operato/commit/be05985abfae4af53501f718dd52932099f7fbcb))
21
+
22
+
23
+
6
24
  ## [8.0.0-beta.0](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.56...v8.0.0-beta.0) (2025-01-07)
7
25
 
8
26
  **Note:** Version bump only for package @operato/context
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@operato/context",
3
3
  "description": "Webcomponent context following open-wc recommendations",
4
4
  "author": "heartyoh",
5
- "version": "8.0.0-beta.0",
5
+ "version": "8.0.0-beta.2",
6
6
  "main": "dist/src/index.js",
7
7
  "module": "dist/src/index.js",
8
8
  "exports": {
@@ -66,12 +66,12 @@
66
66
  },
67
67
  "dependencies": {
68
68
  "@material/web": "^2.0.0",
69
- "@operato/help": "^8.0.0-beta.0",
70
- "@operato/input": "^8.0.0-beta.0",
71
- "@operato/layout": "^8.0.0-beta.0",
72
- "@operato/shell": "^8.0.0-beta.0",
73
- "@operato/styles": "^8.0.0-beta.0",
74
- "@operato/utils": "^8.0.0-beta.0",
69
+ "@operato/help": "^8.0.0-beta.2",
70
+ "@operato/input": "^8.0.0-beta.2",
71
+ "@operato/layout": "^8.0.0-beta.2",
72
+ "@operato/shell": "^8.0.0-beta.2",
73
+ "@operato/styles": "^8.0.0-beta.2",
74
+ "@operato/utils": "^8.0.0-beta.2",
75
75
  "lit": "^3.1.2",
76
76
  "lodash-es": "^4.17.21",
77
77
  "pwa-helpers": "^0.9.1"
@@ -108,5 +108,5 @@
108
108
  "prettier --write"
109
109
  ]
110
110
  },
111
- "gitHead": "c4e9cc245659d050a9ffd66542083a6daad4bcb9"
111
+ "gitHead": "ee1b5124995accb99272d3b5854f3df1d8746dda"
112
112
  }
package/.editorconfig DELETED
@@ -1,29 +0,0 @@
1
- # EditorConfig helps developers define and maintain consistent
2
- # coding styles between different editors and IDEs
3
- # editorconfig.org
4
-
5
- root = true
6
-
7
-
8
- [*]
9
-
10
- # Change these settings to your own preference
11
- indent_style = space
12
- indent_size = 2
13
-
14
- # We recommend you to keep these unchanged
15
- end_of_line = lf
16
- charset = utf-8
17
- trim_trailing_whitespace = true
18
- insert_final_newline = true
19
-
20
- [*.md]
21
- trim_trailing_whitespace = false
22
-
23
- [*.json]
24
- indent_size = 2
25
-
26
- [*.{html,js,md}]
27
- block_comment_start = /**
28
- block_comment = *
29
- block_comment_end = */
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- stories: ['../dist/stories/**/*.stories.{js,md,mdx}'],
3
- };
@@ -1,52 +0,0 @@
1
- import { i18next } from '@operato/i18n'
2
-
3
- export const globalTypes = {
4
- locale: {
5
- name: 'Locale',
6
- description: 'Internationalization locale',
7
- toolbar: {
8
- icon: 'globe',
9
- items: [
10
- { value: 'en', right: '🇺🇸', title: 'English' },
11
- { value: 'ko', right: '🇰🇷', title: '한국어' },
12
- { value: 'zh', right: '🇨🇳', title: '中文' },
13
- { value: 'ja', right: '🇯🇵', title: '日本語' },
14
- { value: 'ms', right: '🇲🇾', title: 'Bahasa Melayu' }
15
- ],
16
- showName: true
17
- }
18
- },
19
- theme: {
20
- name: 'Theme',
21
- description: 'Global theme for components',
22
- toolbar: {
23
- icon: 'paintbrush',
24
- items: [
25
- { value: 'light', title: 'Light' },
26
- { value: 'dark', title: 'Dark' }
27
- ],
28
- showName: true
29
- }
30
- }
31
- }
32
-
33
- export const decorators = [
34
- (Story, context) => {
35
- const { locale, theme } = context.globals
36
-
37
- if (locale) {
38
- i18next.changeLanguage(locale)
39
- }
40
-
41
- // Set the theme class for the document
42
- if (theme === 'dark') {
43
- document.documentElement.classList.add('dark')
44
- document.documentElement.classList.remove('light')
45
- } else {
46
- document.documentElement.classList.add('light')
47
- document.documentElement.classList.remove('dark')
48
- }
49
-
50
- return Story()
51
- }
52
- ]
@@ -1,8 +0,0 @@
1
- import { storybookPlugin } from '@web/dev-server-storybook';
2
- import baseConfig from '../web-dev-server.config.mjs';
3
-
4
- export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
5
- ...baseConfig,
6
- open: '/',
7
- plugins: [storybookPlugin({ type: 'web-components' }), ...baseConfig.plugins],
8
- });
package/demo/index.html DELETED
@@ -1,43 +0,0 @@
1
- <!doctype html>
2
- <html lang="en-GB">
3
- <head>
4
- <meta charset="utf-8" />
5
- <style>
6
- body {
7
- background: #fafafa;
8
- --ox-checkbox-size: 12px;
9
- }
10
-
11
- #demo {
12
- position: relative;
13
- height: 300px;
14
- background-color: lightgray;
15
- vertical-align: middle;
16
- }
17
- </style>
18
- <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet" />
19
- <link
20
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
21
- rel="stylesheet"
22
- />
23
- <link
24
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
25
- rel="stylesheet"
26
- />
27
- <link
28
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
29
- rel="stylesheet"
30
- />
31
- </head>
32
- <body>
33
- <div id="demo"></div>
34
-
35
- <script type="module">
36
- import { html, render } from 'lit'
37
-
38
- const parent = document.querySelector('#demo')
39
-
40
- render(html`clike anywhere in this box to utils mini.`, parent)
41
- </script>
42
- </body>
43
- </html>
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './styles/ox-context-toolbar-overlay-style.js'
@@ -1,121 +0,0 @@
1
- import '@material/web/icon/icon.js'
2
-
3
- import { css, html, LitElement, TemplateResult, nothing } from 'lit'
4
- import { customElement, property, query, state } from 'lit/decorators.js'
5
- import { connect } from 'pwa-helpers/connect-mixin.js'
6
-
7
- import { TOOL_POSITION } from '@operato/layout'
8
- import { store } from '@operato/shell'
9
-
10
- @customElement('ox-context-page-toolbar')
11
- export class ContextPageToolbar extends connect(store)(LitElement) {
12
- static get styles() {
13
- return [
14
- css`
15
- :host {
16
- display: flex;
17
- flex-direction: row-reverse;
18
- gap: var(--spacing-medium);
19
-
20
- position: relative;
21
-
22
- justify-content: end;
23
- align-items: center;
24
-
25
- text-transform: capitalize;
26
-
27
- --context-action-bar-button-margin: var(--spacing-none);
28
- --context-action-bar-more-button-border-radius: 2px;
29
-
30
- --md-icon-size: 20px;
31
- }
32
-
33
- :host > div {
34
- display: flex;
35
- flex-direction: row;
36
-
37
- align-items: center;
38
- gap: var(--spacing-small);
39
- }
40
-
41
- md-icon {
42
- width: 32px;
43
- height: 32px;
44
- box-sizing: border-box;
45
-
46
- color: var(--md-sys-color-on-primary-container);
47
- background-color: var(--md-sys-color-primary-container);
48
- border: 1px solid var(--md-sys-color-primary-container);
49
- border-radius: var(--md-sys-shape-corner-small);
50
- padding: var(--spacing-small);
51
-
52
- &:hover {
53
- color: var(--md-sys-color-on-primary);
54
- background-color: var(--md-sys-color-primary);
55
- border-color: var(--md-sys-color-primary);
56
- }
57
- }
58
-
59
- @media screen and (max-width: 460px) {
60
- :host {
61
- gap: 0;
62
- }
63
-
64
- :host > div {
65
- gap: 0;
66
- }
67
-
68
- md-icon {
69
- border-radius: 0;
70
- }
71
- }
72
- `
73
- ]
74
- }
75
-
76
- @property({ type: Object }) context: any
77
- @property({ type: Array }) tools?: {
78
- position: TOOL_POSITION
79
- template: TemplateResult
80
- context?: string
81
- }[]
82
-
83
- render() {
84
- let contextKeys = Object.keys(this.context).filter(key => !!this.context[key])
85
- let tools = (this.tools || []).filter(tool => {
86
- if (!tool.context || contextKeys.includes(tool.context)) {
87
- return tool
88
- }
89
- })
90
-
91
- let frontEndTools = tools.filter(tool => tool.position == TOOL_POSITION.FRONT_END)
92
- let frontTools = tools.filter(tool => tool.position == TOOL_POSITION.FRONT)
93
- let centerTools = tools.filter(tool => tool.position == TOOL_POSITION.CENTER)
94
- let rearTools = tools.filter(tool => tool.position == TOOL_POSITION.REAR)
95
- let rearEndTools = tools.filter(tool => tool.position == TOOL_POSITION.REAR_END)
96
-
97
- return html`
98
- <slot name="front"></slot>
99
- ${frontEndTools.length > 0
100
- ? html`<div id="front-end">${frontEndTools.map(tool => html` ${tool.template} `)}</div>`
101
- : nothing}
102
- ${frontTools.length > 0
103
- ? html`<div id="front">${frontTools.map(tool => html` ${tool.template} `)}</div>`
104
- : nothing}
105
- ${centerTools.length > 0
106
- ? html`<div id="center">${centerTools.map(tool => html` ${tool.template} `)}</div>`
107
- : nothing}
108
- ${rearTools.length > 0 ? html`<div id="rear">${rearTools.map(tool => html` ${tool.template} `)}</div>` : nothing}
109
- ${rearEndTools.length > 0
110
- ? html`<div id="rear-end">${rearEndTools.map(tool => html` ${tool.template} `)}</div>`
111
- : nothing}
112
- <slot name="rear"></slot>
113
- `
114
- }
115
-
116
- stateChanged(state: any) {
117
- if (state.context) {
118
- this.tools = state.context?.tools
119
- }
120
- }
121
- }
@@ -1,208 +0,0 @@
1
- import '@material/web/icon/icon.js'
2
-
3
- import { css, html, LitElement, nothing, PropertyValues } from 'lit'
4
- import { customElement, property, query, state } from 'lit/decorators.js'
5
- import { connect } from 'pwa-helpers/connect-mixin.js'
6
-
7
- import { TOOL_POSITION } from '@operato/layout'
8
- import { store } from '@operato/shell'
9
-
10
- @customElement('ox-context-toolbar')
11
- export class ContextToolbar extends connect(store)(LitElement) {
12
- static get styles() {
13
- return [
14
- css`
15
- :host {
16
- display: flex;
17
-
18
- color: var(--context-toolbar-background-color, var(--md-sys-color-on-secondary-container));
19
- background-color: var(--context-toolbar-background-color, var(--md-sys-color-secondary-container));
20
- box-shadow: var(--context-toolbar-shadow-line);
21
-
22
- padding: 0;
23
-
24
- --md-icon-size: 20px;
25
- }
26
-
27
- div[container] {
28
- flex: 1;
29
-
30
- display: flex;
31
- position: relative;
32
- overflow: hidden;
33
-
34
- justify-content: space-between;
35
-
36
- gap: var(--spacing-medium);
37
- padding: var(--spacing-small) var(--spacing-medium);
38
-
39
- &:not(:has(> *)) {
40
- padding: 0;
41
- }
42
-
43
- div {
44
- display: flex;
45
- flex-direction: row;
46
- flex-wrap: nowrap;
47
-
48
- align-items: center;
49
- overflow: hidden;
50
- padding: 0;
51
- }
52
-
53
- #front-end md-icon,
54
- #front md-icon {
55
- border: var(--context-toolbar-function-button-border, none);
56
- }
57
-
58
- #front-end md-icon {
59
- color: var(--md-sys-color-on-primary-container);
60
- background-color: var(--md-sys-color-on-primary-container);
61
- }
62
-
63
- #front-end md-icon:hover {
64
- color: var(--md-sys-color-on-primary);
65
- background-color: var(--md-sys-color-primary);
66
- }
67
-
68
- #front md-icon {
69
- color: var(--md-sys-color-on-secondary-container);
70
- background-color: var(--md-sys-color-secondary-container);
71
- }
72
-
73
- #front md-icon:hover {
74
- color: var(--md-sys-on-color-secondary);
75
- background-color: var(--md-sys-color-secondary);
76
- }
77
-
78
- md-icon {
79
- color: var(--md-sys-color-on-primary-container);
80
- background-color: var(--md-sys-color-primary-container);
81
- border: 1px solid var(--md-sys-color-primary-container);
82
- border-radius: var(--md-sys-shape-corner-small);
83
- padding: var(--spacing-small);
84
-
85
- &:hover {
86
- color: var(--md-sys-color-on-primary);
87
- background-color: var(--md-sys-color-primary);
88
- }
89
- }
90
-
91
- div md-icon {
92
- border-radius: 0;
93
- }
94
-
95
- div md-icon:first-child {
96
- border-top-left-radius: var(--md-sys-shape-corner-small);
97
- border-bottom-left-radius: var(--md-sys-shape-corner-small);
98
- }
99
-
100
- div md-icon:last-child {
101
- border-top-right-radius: var(--md-sys-shape-corner-small);
102
- border-bottom-right-radius: var(--md-sys-shape-corner-small);
103
- }
104
-
105
- #center {
106
- flex: 1;
107
- justify-content: end;
108
- }
109
- }
110
-
111
- @media only screen and (max-width: 460px) {
112
- div[container] {
113
- padding: 0;
114
- gap: 0;
115
- --md-assist-chip-container-shape: 0;
116
- }
117
-
118
- div[container] div md-icon {
119
- border-radius: 0 !important;
120
- }
121
-
122
- div[container] div md-icon:not(:last-child) {
123
- border-right-width: 0;
124
- }
125
- }
126
- `
127
- ]
128
- }
129
-
130
- @state() private context: any
131
- @state() private tools?: any[]
132
-
133
- @query('[container]') private container!: HTMLDivElement
134
-
135
- render() {
136
- if (this.context.toolbar === false) {
137
- return nothing
138
- }
139
-
140
- let contextKeys = Object.keys(this.context).filter(key => !!this.context[key])
141
- let tools = (this.tools || []).filter(tool => {
142
- if (!tool.context || contextKeys.includes(tool.context)) {
143
- return tool
144
- }
145
- })
146
-
147
- let frontEndTools = tools.filter(tool => tool.position == TOOL_POSITION.FRONT_END)
148
- let frontTools = tools.filter(tool => tool.position == TOOL_POSITION.FRONT)
149
- let centerTools = tools.filter(tool => tool.position == TOOL_POSITION.CENTER)
150
- let rearTools = tools.filter(tool => tool.position == TOOL_POSITION.REAR)
151
- let rearEndTools = tools.filter(tool => tool.position == TOOL_POSITION.REAR_END)
152
-
153
- return html`
154
- <div container>
155
- ${frontEndTools.length > 0
156
- ? html`<div id="front-end">${frontEndTools.map(tool => html` ${tool.template} `)}</div>`
157
- : nothing}
158
- ${frontTools.length > 0
159
- ? html`<div id="front">${frontTools.map(tool => html` ${tool.template} `)}</div>`
160
- : nothing}
161
- ${centerTools.length > 0
162
- ? html`<div id="center">${centerTools.map(tool => html` ${tool.template} `)}</div>`
163
- : nothing}
164
- ${rearTools.length > 0
165
- ? html`<div id="rear">${rearTools.map(tool => html` ${tool.template} `)}</div>`
166
- : nothing}
167
- ${rearEndTools.length > 0
168
- ? html`<div id="rear-end">${rearEndTools.map(tool => html` ${tool.template} `)}</div>`
169
- : nothing}
170
- </div>
171
- `
172
- }
173
-
174
- updated(changes: PropertyValues<this>) {
175
- requestAnimationFrame(() => {
176
- /*
177
- 하위 엘리먼트들이 실제로 보일 필요가 없을 때는, 이 엘리먼트도 숨김 처리함.
178
- &:not(:has(> *)) 처리로 모두 해결되지 않으므로, 로직 처리로 보완함.
179
- &:not(:has(> *)) 가 필요없으나, 남겨 두었음.
180
- */
181
- if (!this.container) {
182
- return
183
- }
184
-
185
- const children = this.container.querySelectorAll('*')
186
-
187
- let zero = true
188
-
189
- // 모든 하위 엘리먼트의 높이를 확인
190
- for (const child of Array.from(children)) {
191
- if ((child as HTMLElement).offsetHeight !== 0) {
192
- zero = false
193
- break
194
- }
195
- }
196
-
197
- // 모든 하위 엘리먼트의 높이가 0이면 부모 엘리먼트의 display를 none으로 변경
198
- this.container.style.padding = zero ? '0' : 'revert-layer'
199
- })
200
- }
201
-
202
- stateChanged(state: any) {
203
- if (state.context) {
204
- this.tools = state.context.tools || []
205
- this.context = state.route.context || {}
206
- }
207
- }
208
- }
@@ -1,58 +0,0 @@
1
- import { css } from 'lit'
2
-
3
- export const ContextToolbarOverlayStyle = css`
4
- :host {
5
- display: block;
6
-
7
- background-color: var(--context-ui-background-color);
8
- box-shadow: var(--context-ui-box-shadow);
9
- padding: var(--context-ui-padding);
10
- }
11
-
12
- ul {
13
- margin: 0;
14
- padding: 0;
15
- list-style: none;
16
- overflow-y: auto;
17
- }
18
-
19
- li {
20
- display: flex;
21
-
22
- border-bottom: var(--context-ui-list-border-bottom);
23
- padding: var(--context-ui-list-padding);
24
- }
25
-
26
- li > md-icon {
27
- font-size: 1em;
28
-
29
- padding: var(--context-ui-padding);
30
- color: var(--context-ui-list-color);
31
- }
32
-
33
- li > span {
34
- margin: auto 0;
35
- flex: 1;
36
-
37
- color: var(--context-ui-list-color);
38
- }
39
-
40
- li:hover md-icon,
41
- li:hover span {
42
- color: #fff;
43
- }
44
-
45
- li:hover {
46
- cursor: pointer;
47
-
48
- border-bottom: var(--context-ui-list-border-hover-bottom);
49
- }
50
-
51
- @media (max-width: 460px) {
52
- :host {
53
- min-width: 100%;
54
- box-shadow: none;
55
- border-radius: 0;
56
- }
57
- }
58
- `