@stonecrop/desktop 0.4.37 → 0.5.0

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/dist/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import ActionSet from './components/ActionSet.vue';
2
2
  import CommandPalette from './components/CommandPalette.vue';
3
- import Doctype from './components/Doctype.vue';
4
- import Records from './components/Records.vue';
3
+ import Desktop from './components/Desktop.vue';
5
4
  import SheetNav from './components/SheetNav.vue';
6
5
  import StonecropDesktop from './plugins';
7
- export { ActionSet, CommandPalette, Doctype, Records, SheetNav, StonecropDesktop };
6
+ export { ActionSet, CommandPalette, Desktop, SheetNav, StonecropDesktop };
@@ -1,7 +1,6 @@
1
1
  import ActionSet from '../components/ActionSet.vue';
2
2
  import CommandPalette from '../components/CommandPalette.vue';
3
- import Doctype from '../components/Doctype.vue';
4
- import Records from '../components/Records.vue';
3
+ import Desktop from '../components/Desktop.vue';
5
4
  import SheetNav from '../components/SheetNav.vue';
6
5
  /**
7
6
  * This is the main plugin that will be used to register all the desktop components.
@@ -11,8 +10,7 @@ const plugin = {
11
10
  install: (app) => {
12
11
  app.component('ActionSet', ActionSet);
13
12
  app.component('CommandPalette', CommandPalette);
14
- app.component('Doctype', Doctype);
15
- app.component('Records', Records);
13
+ app.component('Desktop', Desktop);
16
14
  app.component('SheetNav', SheetNav);
17
15
  },
18
16
  };
@@ -1,9 +1,8 @@
1
1
  import ActionSet from './components/ActionSet.vue';
2
2
  import CommandPalette from './components/CommandPalette.vue';
3
- import Doctype from './components/Doctype.vue';
4
- import Records from './components/Records.vue';
3
+ import Desktop from './components/Desktop.vue';
5
4
  import SheetNav from './components/SheetNav.vue';
6
5
  import StonecropDesktop from './plugins';
7
6
  export type * from './types';
8
- export { ActionSet, CommandPalette, Doctype, Records, SheetNav, StonecropDesktop };
7
+ export { ActionSet, CommandPalette, Desktop, SheetNav, StonecropDesktop };
9
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,4BAA4B,CAAA;AAClD,OAAO,cAAc,MAAM,iCAAiC,CAAA;AAC5D,OAAO,OAAO,MAAM,0BAA0B,CAAA;AAC9C,OAAO,OAAO,MAAM,0BAA0B,CAAA;AAC9C,OAAO,QAAQ,MAAM,2BAA2B,CAAA;AAChD,OAAO,gBAAgB,MAAM,WAAW,CAAA;AACxC,mBAAmB,SAAS,CAAA;AAE5B,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,4BAA4B,CAAA;AAClD,OAAO,cAAc,MAAM,iCAAiC,CAAA;AAC5D,OAAO,OAAO,MAAM,0BAA0B,CAAA;AAC9C,OAAO,QAAQ,MAAM,2BAA2B,CAAA;AAChD,OAAO,gBAAgB,MAAM,WAAW,CAAA;AACxC,mBAAmB,SAAS,CAAA;AAE5B,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,MAAM,EAAE,MAAM,KAAK,CAAA;AAQtC;;;GAGG;AACH,QAAA,MAAM,MAAM,EAAE,MAQb,CAAA;AAED,eAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,MAAM,EAAE,MAAM,KAAK,CAAA;AAOtC;;;GAGG;AACH,QAAA,MAAM,MAAM,EAAE,MAOb,CAAA;AAED,eAAe,MAAM,CAAA"}
@@ -20,6 +20,7 @@ export type ElementAction = BaseElement & {
20
20
  */
21
21
  export type ButtonElement = BaseElement & ElementAction & {
22
22
  type: 'button';
23
+ disabled?: boolean;
23
24
  };
24
25
  /**
25
26
  * Dropdown elements
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,OAAO,CAAA;CACd,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG;IACzC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;CACnB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,WAAW,GACtC,aAAa,GAAG;IACf,IAAI,EAAE,QAAQ,CAAA;CACd,CAAA;AAEF;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG;IAC3C,IAAI,EAAE,UAAU,CAAA;IAChB,OAAO,EAAE,aAAa,EAAE,CAAA;CACxB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,eAAe,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,OAAO,CAAA;CACd,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG;IACzC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;CACnB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,WAAW,GACtC,aAAa,GAAG;IACf,IAAI,EAAE,QAAQ,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAEF;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG;IAC3C,IAAI,EAAE,UAAU,CAAA;IAChB,OAAO,EAAE,aAAa,EAAE,CAAA;CACxB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,eAAe,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stonecrop/desktop",
3
- "version": "0.4.37",
3
+ "version": "0.5.0",
4
4
  "description": "Desktop-specific components for Stonecrop UI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -37,10 +37,10 @@
37
37
  ],
38
38
  "dependencies": {
39
39
  "vue": "^3.5.22",
40
- "@stonecrop/aform": "0.4.37",
41
- "@stonecrop/atable": "0.4.37",
42
- "@stonecrop/stonecrop": "0.4.37",
43
- "@stonecrop/themes": "0.4.37"
40
+ "@stonecrop/themes": "0.5.0",
41
+ "@stonecrop/aform": "0.5.0",
42
+ "@stonecrop/atable": "0.5.0",
43
+ "@stonecrop/stonecrop": "0.5.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@eslint/js": "^9.38.0",
@@ -69,7 +69,6 @@
69
69
  "_phase:build": "heft build && vite build && rushx docs",
70
70
  "prepublish": "heft build && vite build && rushx docs",
71
71
  "build": "heft build && vite build && rushx docs",
72
- "dev": "vite",
73
72
  "docs": "cd ../common/autoinstallers/doc-tools && node generate-docs.mjs desktop",
74
73
  "lint": "eslint ."
75
74
  }
@@ -38,14 +38,22 @@
38
38
  </div>
39
39
  </div>
40
40
  <div style="margin-right: 30px"></div>
41
- <div v-for="(el, index) in _elements" :key="el.label" class="action-element">
42
- <button v-if="el.type == 'button'" :onclick="el.action" class="button-default">{{ el.label }}</button>
41
+ <div v-for="(el, index) in elements" :key="el.label" class="action-element">
42
+ <button
43
+ v-if="el.type == 'button'"
44
+ :disabled="el.disabled"
45
+ class="button-default"
46
+ @click="handleClick(el.action, el.label)">
47
+ {{ el.label }}
48
+ </button>
43
49
  <div v-if="el.type == 'dropdown'">
44
50
  <button class="button-default" @click="toggleDropdown(index)">{{ el.label }}</button>
45
- <div v-show="el.show" class="dropdown-container">
51
+ <div v-show="dropdownStates[index]" class="dropdown-container">
46
52
  <div class="dropdown">
47
- <div v-for="item in el.actions" :key="item.label">
48
- <button v-if="item.action != null" :onclick="item.action" class="dropdown-item">{{ item.label }}</button>
53
+ <div v-for="(item, itemIndex) in el.actions" :key="item.label">
54
+ <button v-if="item.action != null" class="dropdown-item" @click="handleClick(item.action, item.label)">
55
+ {{ item.label }}
56
+ </button>
49
57
  <a v-else-if="item.link != null" :href="item.link"
50
58
  ><button class="dropdown-item">{{ item.label }}</button></a
51
59
  >
@@ -63,8 +71,13 @@ import { onMounted, ref } from 'vue'
63
71
  import type { ActionElements } from '../types'
64
72
 
65
73
  const { elements = [] } = defineProps<{ elements?: ActionElements[] }>()
74
+ const emit = defineEmits<{
75
+ actionClick: [label: string, action: (() => void | Promise<void>) | undefined]
76
+ }>()
77
+
78
+ // Track dropdown open state separately (index -> boolean)
79
+ const dropdownStates = ref<Record<number, boolean>>({})
66
80
 
67
- const _elements = ref(elements)
68
81
  const isOpen = ref(false)
69
82
  const timeoutId = ref<number>(-1)
70
83
  const hover = ref(false)
@@ -75,11 +88,7 @@ onMounted(() => {
75
88
  })
76
89
 
77
90
  const closeDropdowns = () => {
78
- for (const element of _elements.value) {
79
- if (element.type === 'dropdown') {
80
- element.show = false
81
- }
82
- }
91
+ dropdownStates.value = {}
83
92
  }
84
93
 
85
94
  const onHover = () => {
@@ -99,9 +108,16 @@ const onHoverLeave = () => {
99
108
  }
100
109
 
101
110
  const toggleDropdown = (index: number) => {
102
- const showDropdown = !_elements.value[index].show
111
+ const showDropdown = !dropdownStates.value[index]
103
112
  closeDropdowns()
104
- _elements.value[index].show = showDropdown
113
+ if (showDropdown) {
114
+ dropdownStates.value[index] = true
115
+ }
116
+ }
117
+
118
+ const handleClick = (action: (() => void | Promise<void>) | undefined, label: string) => {
119
+ // Emit event to parent - parent will handle execution
120
+ emit('actionClick', label, action)
105
121
  }
106
122
  </script>
107
123
 
@@ -154,6 +170,7 @@ const toggleDropdown = (index: number) => {
154
170
  flex-direction: row-reverse;
155
171
  background-color: white;
156
172
  overflow: hidden;
173
+ z-index: 1001; /* Above SheetNav (100) and operation log button (999) */
157
174
  }
158
175
 
159
176
  .action-menu-icon {
@@ -208,6 +225,7 @@ const toggleDropdown = (index: number) => {
208
225
  .action-element {
209
226
  margin-left: 5px;
210
227
  margin-right: 5px;
228
+ position: relative; /* Make this the positioning context for absolute children */
211
229
  }
212
230
  button.button-default {
213
231
  background-color: #ffffff;
@@ -224,19 +242,30 @@ button.button-default:hover {
224
242
  background-color: #f2f2f2;
225
243
  }
226
244
 
245
+ button.button-default:disabled {
246
+ opacity: 0.5;
247
+ cursor: not-allowed;
248
+ background-color: #f5f5f5;
249
+ color: #999;
250
+ }
251
+
252
+ button.button-default:disabled:hover {
253
+ background-color: #f5f5f5;
254
+ }
255
+
227
256
  .dropdown-container {
228
257
  position: relative;
229
258
  }
230
259
 
231
260
  .dropdown {
232
261
  position: absolute;
233
- top: 5px;
234
262
  right: 0;
235
263
  min-width: 200px;
236
264
  box-shadow: 0 0.5rem 1rem rgb(0 0 0 / 18%);
237
265
  border-radius: 10px;
238
266
  background-color: #ffffff;
239
267
  padding: 10px;
268
+ z-index: 1000;
240
269
  }
241
270
 
242
271
  button.dropdown-item {