@operato/process 7.1.30 → 7.1.32

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.
Files changed (57) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/tsconfig.tsbuildinfo +1 -1
  3. package/package.json +14 -14
  4. package/.storybook/main.js +0 -3
  5. package/.storybook/preview.js +0 -52
  6. package/.storybook/server.mjs +0 -8
  7. package/demo/index-modeller.html +0 -112
  8. package/demo/index-viewer.html +0 -112
  9. package/demo/index.html +0 -112
  10. package/src/data-storage/data-storage.ts +0 -47
  11. package/src/graphql/data-subscription.ts +0 -30
  12. package/src/graphql/favorite-process.ts +0 -25
  13. package/src/graphql/index.ts +0 -3
  14. package/src/graphql/process-group.ts +0 -138
  15. package/src/graphql/process.ts +0 -141
  16. package/src/graphql/scenario.ts +0 -79
  17. package/src/index.ts +0 -8
  18. package/src/modeller/component-toolbar/component-detail.ts +0 -58
  19. package/src/modeller/component-toolbar/component-menu.ts +0 -193
  20. package/src/modeller/component-toolbar/component-toolbar.ts +0 -196
  21. package/src/modeller/component-toolbar/mode-icons.ts +0 -88
  22. package/src/modeller/edit-toolbar-style.ts +0 -229
  23. package/src/modeller/edit-toolbar.ts +0 -576
  24. package/src/modeller/property-sidebar/abstract-property.ts +0 -69
  25. package/src/modeller/property-sidebar/data-binding/data-binding-mapper.ts +0 -475
  26. package/src/modeller/property-sidebar/data-binding/data-binding.ts +0 -479
  27. package/src/modeller/property-sidebar/effects/effects-shared-style.ts +0 -62
  28. package/src/modeller/property-sidebar/effects/effects.ts +0 -52
  29. package/src/modeller/property-sidebar/effects/property-event-hover.ts +0 -201
  30. package/src/modeller/property-sidebar/effects/property-event-tap.ts +0 -212
  31. package/src/modeller/property-sidebar/effects/property-event.ts +0 -76
  32. package/src/modeller/property-sidebar/effects/property-shadow.ts +0 -114
  33. package/src/modeller/property-sidebar/effects/value-converter.ts +0 -23
  34. package/src/modeller/property-sidebar/inspector/inspector.ts +0 -408
  35. package/src/modeller/property-sidebar/property-shared-style.ts +0 -136
  36. package/src/modeller/property-sidebar/property-sidebar.ts +0 -342
  37. package/src/modeller/property-sidebar/shapes/box-padding-editor-styles.ts +0 -94
  38. package/src/modeller/property-sidebar/shapes/shapes.ts +0 -410
  39. package/src/modeller/property-sidebar/specifics/specific-properties-builder.ts +0 -147
  40. package/src/modeller/property-sidebar/specifics/specifics.ts +0 -81
  41. package/src/modeller/property-sidebar/styles/styles.ts +0 -577
  42. package/src/ox-editor-process-selector.ts +0 -91
  43. package/src/ox-process-list.ts +0 -401
  44. package/src/ox-process-modeller.ts +0 -432
  45. package/src/ox-process-template-list.ts +0 -272
  46. package/src/ox-process-template-viewer.ts +0 -198
  47. package/src/ox-process-viewer.ts +0 -575
  48. package/src/ox-property-editor-process-selector.ts +0 -23
  49. package/src/selector/ox-process-creation-card.ts +0 -95
  50. package/src/selector/ox-process-selector.ts +0 -324
  51. package/src/selector/process-creation-popup.ts +0 -151
  52. package/src/selector/process-thumbnail-card.ts +0 -175
  53. package/src/types.ts +0 -57
  54. package/stories/index.stories.ts +0 -54
  55. package/tsconfig.json +0 -24
  56. package/web-dev-server.config.mjs +0 -30
  57. package/web-test-runner.config.mjs +0 -29
@@ -1,141 +0,0 @@
1
- import { buildArgs, client } from '@operato/graphql'
2
-
3
- import { Process } from '../types'
4
- import gql from 'graphql-tag'
5
-
6
- export async function fetchProcessList(listParam = {}) {
7
- const response = await client.query({
8
- query: gql`
9
- {
10
- processes(${buildArgs(listParam)}) {
11
- items {
12
- id
13
- name
14
- description
15
- thumbnail
16
- createdAt
17
- updatedAt
18
- }
19
- total
20
- }
21
- }
22
- `
23
- })
24
-
25
- return response.data
26
- }
27
-
28
- export async function fetchProcess(id: string) {
29
- const response = await client.query({
30
- query: gql`
31
- query FetchProcessById($id: String!) {
32
- process(id: $id) {
33
- id
34
- name
35
- description
36
- group {
37
- id
38
- name
39
- }
40
- thumbnail
41
- model
42
- createdAt
43
- creator {
44
- id
45
- name
46
- }
47
- updatedAt
48
- updater {
49
- id
50
- name
51
- }
52
- }
53
- }
54
- `,
55
- variables: { id }
56
- })
57
-
58
- return response.data
59
- }
60
-
61
- export async function createProcess(process: Process) {
62
- /*
63
- input NewProcess {
64
- name : String!
65
- description : String
66
- model : String!
67
- groupId : String!
68
- }
69
- */
70
-
71
- const response = await client.mutate({
72
- mutation: gql`
73
- mutation CreateProcess($process: NewProcess!) {
74
- createProcess(process: $process) {
75
- id
76
- name
77
- description
78
- model
79
- createdAt
80
- updatedAt
81
- }
82
- }
83
- `,
84
- variables: {
85
- process
86
- }
87
- })
88
-
89
- return response.data
90
- }
91
-
92
- export async function updateProcess(process: Process) {
93
- /*
94
- input ProcessPatch {
95
- name : String
96
- description : String
97
- model : String
98
- }
99
- */
100
- var { id, name, description, model, groupId } = process
101
-
102
- const response = await client.mutate({
103
- mutation: gql`
104
- mutation UpdateProcess($id: String!, $patch: ProcessPatch!) {
105
- updateProcess(id: $id, patch: $patch) {
106
- id
107
- name
108
- description
109
- model
110
- group {
111
- id
112
- name
113
- }
114
- createdAt
115
- updatedAt
116
- }
117
- }
118
- `,
119
- variables: {
120
- id,
121
- patch: { name, description, model, groupId }
122
- }
123
- })
124
-
125
- return response.data
126
- }
127
-
128
- export async function deleteProcess(id: string) {
129
- const response = await client.mutate({
130
- mutation: gql`
131
- mutation ($id: String!) {
132
- deleteProcess(id: $id)
133
- }
134
- `,
135
- variables: {
136
- id
137
- }
138
- })
139
-
140
- return response.data
141
- }
@@ -1,79 +0,0 @@
1
- import gql from 'graphql-tag'
2
-
3
- import { client } from '@operato/graphql'
4
-
5
- export const scenarios = async (): Promise<{ name: string; description: string }[]> => {
6
- var response = await client.query({
7
- query: gql`
8
- query {
9
- scenarios {
10
- items {
11
- name
12
- description
13
- }
14
- }
15
- }
16
- `
17
- })
18
-
19
- if (response.errors) {
20
- return []
21
- }
22
-
23
- return response.data.scenarios.items
24
- }
25
-
26
- export const startScenario = async (
27
- scenarioName: string,
28
- instanceName: string,
29
- variables: string | number | object
30
- ) => {
31
- if (!scenarioName) {
32
- return
33
- }
34
-
35
- if (client) {
36
- var response = await client.query({
37
- query: gql`
38
- mutation ($instanceName: String, $scenarioName: String!, $variables: Object) {
39
- startScenario(instanceName: $instanceName, scenarioName: $scenarioName, variables: $variables) {
40
- state
41
- message
42
- data
43
- }
44
- }
45
- `,
46
- variables: {
47
- instanceName: instanceName,
48
- scenarioName: scenarioName,
49
- variables
50
- }
51
- })
52
-
53
- return response?.data?.startScenario?.data
54
- }
55
- }
56
-
57
- export const runScenario = async (scenarioName: string, variables: string | number | object) => {
58
- if (!scenarioName) return
59
-
60
- if (client) {
61
- var response = await client.query({
62
- query: gql`
63
- mutation ($scenarioName: String!, $variables: Object) {
64
- runScenario(scenarioName: $scenarioName, variables: $variables) {
65
- state
66
- message
67
- data
68
- }
69
- }
70
- `,
71
- variables: {
72
- scenarioName: scenarioName,
73
- variables
74
- }
75
- })
76
-
77
- return response?.data?.runScenario?.data
78
- }
79
- }
package/src/index.ts DELETED
@@ -1,8 +0,0 @@
1
- export * from './types.js'
2
-
3
- export { DataStorage } from './data-storage/data-storage.js'
4
-
5
- export * from './ox-process-viewer.js'
6
- export * from './ox-process-modeller.js'
7
- export * from './ox-process-list.js'
8
- export * from './ox-process-template-viewer.js'
@@ -1,58 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import '@operato/markdown'
6
-
7
- import { css, html, LitElement } from 'lit'
8
- import { property } from 'lit/decorators.js'
9
-
10
- import { ScrollbarStyles } from '@operato/styles'
11
-
12
- export class ComponentDetail extends LitElement {
13
- static styles = [
14
- ScrollbarStyles,
15
- css`
16
- :host {
17
- display: flex;
18
- flex-direction: column;
19
- align-content: stretch;
20
-
21
- background-color: var(--component-detail-background-color, white);
22
- margin: 0px;
23
- padding: 0px;
24
-
25
- overflow: hidden;
26
-
27
- border: 2px solid var(--component-detail-border-color, gray);
28
- box-sizing: border-box;
29
-
30
- top: 0px;
31
-
32
- z-index: 1;
33
- }
34
-
35
- ox-markdown,
36
- iframe {
37
- flex: 1;
38
- padding: 10px;
39
- overflow: auto;
40
- }
41
- `
42
- ]
43
-
44
- @property({ type: Object }) template: { about: string } | null = null
45
-
46
- render() {
47
- const { about } = this.template || {}
48
-
49
- if (about) {
50
- var aboutURL = new URL(about, location.origin)
51
- if (aboutURL.origin !== location.origin) {
52
- return html`<iframe src=${about}></iframe>`
53
- }
54
- }
55
-
56
- return html` <ox-markdown .src=${about}></ox-markdown> `
57
- }
58
- }
@@ -1,193 +0,0 @@
1
- import { css, html, LitElement, PropertyValues } from 'lit'
2
- import { property, query, state } from 'lit/decorators.js'
3
-
4
- import { Scene } from '@hatiolab/things-scene'
5
- import { ScopedElementsMixin } from '@open-wc/scoped-elements'
6
- import { ScrollbarStyles } from '@operato/styles'
7
- import { i18next } from '@operato/i18n'
8
-
9
- import { Pallet, PalletItem } from '../../types'
10
- import { ComponentDetail } from './component-detail'
11
-
12
- const noImage = new URL('../../../../icons/components/no-image.png', import.meta.url).href
13
-
14
- export class ComponentMenu extends ScopedElementsMixin(LitElement) {
15
- static styles = [
16
- ScrollbarStyles,
17
- css`
18
- :host {
19
- display: flex;
20
- flex-direction: column;
21
- align-content: stretch;
22
-
23
- background-color: var(--component-menu-background-color, var(--md-sys-color-secondary-container));
24
- color: var(--component-menu-color, var(--md-sys-color-on-secondary-container));
25
- margin: 0px;
26
- padding: 0px;
27
-
28
- width: 180px;
29
- height: 100%;
30
-
31
- overflow: visible;
32
-
33
- border: 2px solid var(--component-menu-border-color, var(--md-sys-color-secondary));
34
- box-sizing: border-box;
35
-
36
- position: absolute;
37
- top: 0px;
38
-
39
- z-index: 1;
40
- }
41
-
42
- h2 {
43
- background-color: var(--component-menu-border-color, var(--md-sys-color-secondary));
44
- padding: 1px 5px;
45
- margin: 0;
46
- font: var(--component-menu-title);
47
- color: var(--md-sys-color-on-secondary);
48
- text-transform: capitalize;
49
- }
50
-
51
- [templates] {
52
- flex: 1;
53
-
54
- display: block;
55
- margin: 0;
56
- padding: 0;
57
- overflow-y: auto;
58
-
59
- background-color: var(--component-menu-background-color, var(--md-sys-color-secondary-container));
60
- color: var(--component-menu-color, var(--md-sys-color-on-secondary-container));
61
- }
62
-
63
- [template] {
64
- display: flex;
65
- align-items: center;
66
- min-height: var(--component-menu-item-icon-size-height);
67
- padding: 0 5px 0 0;
68
- border-bottom: 1px solid rgba(0, 0, 0, 0.1);
69
- font-size: 11px;
70
- color: var(--component-menu-item-color, var(--md-sys-color-on-secondary-container));
71
- text-transform: capitalize;
72
- }
73
-
74
- [template]:hover,
75
- [template]:focus {
76
- color: var(--component-menu-item-hover-color, var(--md-sys-color-secondary));
77
- font-weight: bold;
78
- cursor: pointer;
79
- }
80
-
81
- [template] img {
82
- margin: 5px;
83
- max-width: var(--component-menu-item-icon-size-width);
84
- max-height: var(--component-menu-item-icon-size-height);
85
- }
86
-
87
- process-component-detail {
88
- position: absolute;
89
- top: 0;
90
- left: 180px;
91
- height: 100%;
92
- width: calc(100vw - 510px);
93
- outline: none;
94
- }
95
-
96
- process-component-detail[hidden] {
97
- display: none;
98
- }
99
- `
100
- ]
101
-
102
- @property({ type: Object }) groups: Pallet[] = []
103
- @property({ type: Object }) scene: Scene | null = null
104
- @property({ type: String }) group: string | null = ''
105
-
106
- @state() templates: PalletItem[] = []
107
- @state() template: PalletItem | any
108
-
109
- @query('process-component-detail') detail!: HTMLElement
110
-
111
- static get scopedElements() {
112
- return {
113
- 'process-component-detail': ComponentDetail
114
- }
115
- }
116
-
117
- render() {
118
- return this.group
119
- ? html`
120
- <h2 @click=${(e: MouseEvent) => e.stopPropagation()}>${this.group} list</h2>
121
-
122
- <div templates @mouseover=${(e: MouseEvent) => this.onHoverComponent(e)}>
123
- ${(this.templates || []).map(template => {
124
- const { type } = template
125
-
126
- return html`
127
- <div @click=${this.onClickTemplate} data-type=${type} template>
128
- <img src=${String(this.templateIcon(template))} />${i18next.t(`component.${type}`)}
129
- </div>
130
- `
131
- })}
132
- </div>
133
-
134
- <process-component-detail
135
- tabindex="-1"
136
- @focusout=${() => {
137
- this.template = null
138
- }}
139
- .template=${this.template}
140
- hidden
141
- >
142
- </process-component-detail>
143
- `
144
- : html``
145
- }
146
-
147
- updated(changes: PropertyValues<this>) {
148
- if (changes.has('group')) {
149
- if (!this.group) {
150
- this.templates = []
151
- this.setAttribute('hidden', '')
152
- } else {
153
- this.templates = this.groups.find((g: Pallet) => g.name === this.group)?.templates || []
154
- this.removeAttribute('active')
155
- }
156
- }
157
-
158
- if (changes.has('template')) {
159
- this.template && this.template.about
160
- ? this.detail.removeAttribute('hidden')
161
- : this.detail.setAttribute('hidden', '')
162
- }
163
- }
164
-
165
- findTemplate(type: string | null | undefined) {
166
- this.template = type && this.templates.find(template => template.type == type)
167
- }
168
-
169
- onHoverComponent(e: MouseEvent) {
170
- const button = e.target as HTMLElement
171
- this.findTemplate(button!.closest('[data-type]')?.getAttribute('data-type'))
172
- }
173
-
174
- onClickTemplate(e: MouseEvent) {
175
- var item = e.target as HTMLElement
176
- var type = item.closest('[data-type]')?.getAttribute('data-type')
177
-
178
- if (!type) {
179
- return
180
- }
181
-
182
- if (this.scene) {
183
- this.template = this.templates.find(template => template.type == type)
184
- this.template && this.scene.startAddMode(JSON.parse(JSON.stringify(this.template.model)))
185
- }
186
-
187
- this.group = null
188
- }
189
-
190
- templateIcon(template: PalletItem) {
191
- return template.icon || noImage
192
- }
193
- }
@@ -1,196 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import { css, html, LitElement, PropertyValues } from 'lit'
6
- import { property, query, queryAll } from 'lit/decorators.js'
7
-
8
- import { Scene, SCENE_MODE } from '@hatiolab/things-scene'
9
- import { ScopedElementsMixin } from '@open-wc/scoped-elements'
10
-
11
- import { ComponentGroup } from '../../types'
12
- import { ComponentMenu } from './component-menu.js'
13
- import { ICON_EDIT_MODE, ICON_SHIFT_MODE } from './mode-icons'
14
-
15
- export class ComponentToolbar extends ScopedElementsMixin(LitElement) {
16
- static styles = [
17
- css`
18
- :host {
19
- left: 0;
20
- display: block;
21
- position: relative;
22
-
23
- width: var(--component-toolbar-icon-size);
24
- background-color: var(--component-toolbar-background-color);
25
- }
26
-
27
- [components] {
28
- display: block;
29
- padding: 0;
30
- margin: 0;
31
-
32
- width: 100%;
33
- height: 100%;
34
- overflow: hidden;
35
- }
36
-
37
- [components] > img {
38
- display: flex;
39
- flex-direction: row;
40
-
41
- width: var(--component-toolbar-icon-size);
42
- height: var(--component-toolbar-icon-size);
43
- min-width: 50%;
44
-
45
- border-bottom: var(--component-toolbar-border);
46
- margin: 0;
47
- padding: 6px;
48
- box-sizing: border-box;
49
- }
50
-
51
- #shift[active] {
52
- background-color: #beb9b3;
53
- }
54
-
55
- process-component-menu {
56
- position: absolute;
57
- top: 0;
58
- left: var(--component-toolbar-icon-size);
59
- height: 100%;
60
- outline: none;
61
- }
62
-
63
- process-component-menu[hidden] {
64
- display: none;
65
- }
66
- `
67
- ]
68
-
69
- @property({ type: Array }) componentGroupList: ComponentGroup[] = []
70
- @property({ type: String }) group?: string | null
71
- @property({ type: Object }) scene!: Scene
72
- @property({ type: Number }) mode: SCENE_MODE = SCENE_MODE.EDIT
73
-
74
- @query('#shift') shift!: HTMLImageElement
75
- @query('process-component-menu') private menu!: HTMLElement
76
- @query('div[components]') private componentsContainer!: HTMLElement
77
- @queryAll('[data-group]') private groups!: NodeListOf<HTMLElement>
78
-
79
- private icons: { [name: string]: string } = {}
80
-
81
- updated(changes: PropertyValues<this>) {
82
- if (changes.has('componentGroupList')) {
83
- const color = getComputedStyle(this, null).getPropertyValue('--md-sys-color-primary')
84
-
85
- this.icons = (this.componentGroupList || [])
86
- .filter(group => group.templates?.length > 0)
87
- .reduce(
88
- (sum, group: ComponentGroup) => {
89
- sum[group.name] =
90
- 'data:image/svg+xml;charset=UTF-8;base64,' + btoa(group.icon.replace(/{{strokeColor}}/g, color))
91
- return sum
92
- },
93
- {} as { [name: string]: string }
94
- )
95
-
96
- this.icons['mode-edit'] =
97
- 'data:image/svg+xml;charset=UTF-8;base64,' + btoa(ICON_EDIT_MODE.replace(/{{strokeColor}}/g, color))
98
- this.icons['mode-shift'] =
99
- 'data:image/svg+xml;charset=UTF-8;base64,' + btoa(ICON_SHIFT_MODE.replace(/{{strokeColor}}/g, color))
100
- }
101
-
102
- if (changes.has('group')) {
103
- this.groups.forEach(group => {
104
- group.getAttribute('data-group') === this.group
105
- ? group.setAttribute('active', '')
106
- : group.removeAttribute('active')
107
- })
108
-
109
- this.group ? this.menu.removeAttribute('hidden') : this.menu.setAttribute('hidden', '')
110
- }
111
- }
112
-
113
- static get scopedElements() {
114
- return {
115
- 'process-component-menu': ComponentMenu
116
- }
117
- }
118
-
119
- render() {
120
- const componentList = this.componentGroupList || []
121
- const modeIcon = this.icons[this.mode === SCENE_MODE.SHIFT ? 'mode-shift' : 'mode-edit']
122
-
123
- return html`
124
- <div components @mousewheel=${(e: MouseEvent) => this.onWheelEvent(e)}>
125
- <img id="shift" .src=${modeIcon} @click=${(e: MouseEvent) => this._onClickShift(e)} />
126
-
127
- ${componentList
128
- .filter(group => group.templates?.length > 0)
129
- .map(
130
- group => html`
131
- <img
132
- data-group=${group.name}
133
- @click=${(e: MouseEvent) => this._onClickGroup(e)}
134
- .src=${this.icons[group.name]}
135
- />
136
- `
137
- )}
138
- </div>
139
-
140
- <process-component-menu
141
- tabindex="-1"
142
- @focusout=${() => {
143
- this.group = null
144
- }}
145
- .scene=${this.scene}
146
- .group=${this.group}
147
- .groups=${componentList}
148
- hidden
149
- >
150
- </process-component-menu>
151
- `
152
- }
153
-
154
- onWheelEvent(e: Event) {
155
- var delta = Math.max(-1, Math.min(1, (e as WheelEvent).deltaY || -(e as WheelEvent).detail))
156
- this.componentsContainer.scrollTop += delta * 10
157
-
158
- e.preventDefault()
159
- }
160
-
161
- _setMode(mode: SCENE_MODE) {
162
- this.mode = mode
163
-
164
- this.dispatchEvent(
165
- new CustomEvent('mode-changed', {
166
- bubbles: true,
167
- composed: true,
168
- detail: { value: mode }
169
- })
170
- )
171
- }
172
-
173
- _onClickShift(e: MouseEvent) {
174
- const shift = this.shift
175
-
176
- if (shift.hasAttribute('active')) {
177
- shift.removeAttribute('active')
178
- this._setMode(SCENE_MODE.EDIT)
179
- } else {
180
- shift.setAttribute('active', '')
181
- this._setMode(SCENE_MODE.SHIFT)
182
- }
183
- }
184
-
185
- async _onClickGroup(e: MouseEvent) {
186
- var button = e.target as HTMLElement
187
-
188
- this.group = button!.closest('[data-group]')?.getAttribute('data-group')
189
-
190
- if (!this.group) return
191
-
192
- await this.updateComplete
193
-
194
- this.menu?.focus()
195
- }
196
- }