@conduction/nextcloud-vue 2.89.1 → 2.90.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.
Files changed (29) hide show
  1. package/dist/esm/components/CnAdminSettingsShell/CnAdminSettingsShell.vue.js +1 -1
  2. package/dist/esm/components/CnAdminSettingsShell/CnAdminSettingsShell.vue2.js +13 -0
  3. package/dist/esm/components/CnAdminSettingsShell/CnAdminSettingsShell.vue2.js.map +1 -1
  4. package/dist/esm/components/CnAdminSettingsShell/CnAdminSettingsShell.vue3.js +3 -1
  5. package/dist/esm/components/CnAdminSettingsShell/CnAdminSettingsShell.vue3.js.map +1 -1
  6. package/dist/esm/components/CnDashboardGrid/CnDashboardGrid.vue.js +1 -1
  7. package/dist/esm/components/CnDashboardGrid/CnDashboardGrid.vue2.js +27 -10
  8. package/dist/esm/components/CnDashboardGrid/CnDashboardGrid.vue2.js.map +1 -1
  9. package/dist/esm/components/CnDashboardGrid/CnDashboardGrid.vue3.js.map +1 -1
  10. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue.js +1 -1
  11. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js +18 -0
  12. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js.map +1 -1
  13. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js +2 -2
  14. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js.map +1 -1
  15. package/dist/esm/library-style.js +1 -1
  16. package/dist/esm/nextcloud-vue.css +71 -71
  17. package/dist/esm/utils/declaredProps.js +106 -0
  18. package/dist/esm/utils/declaredProps.js.map +1 -0
  19. package/dist/esm/utils/gridStack.js +7 -3
  20. package/dist/esm/utils/gridStack.js.map +1 -1
  21. package/dist/nextcloud-vue.cjs.js +184 -30
  22. package/dist/nextcloud-vue.cjs.js.map +2 -2
  23. package/dist/nextcloud-vue.css +71 -71
  24. package/package.json +1 -1
  25. package/src/components/CnAdminSettingsShell/CnAdminSettingsShell.vue +14 -1
  26. package/src/components/CnDashboardGrid/CnDashboardGrid.vue +27 -10
  27. package/src/components/CnDashboardPage/CnDashboardPage.vue +20 -2
  28. package/src/utils/declaredProps.js +115 -0
  29. package/src/utils/gridStack.js +7 -3
@@ -0,0 +1,115 @@
1
+ /**
2
+ * SPDX-FileCopyrightText: 2026 Conduction B.V.
3
+ * SPDX-License-Identifier: EUPL-1.2
4
+ */
5
+
6
+ /*
7
+ * `process.env.NODE_ENV` is substituted by every consuming app's bundler at
8
+ * build time; see NcSelectTags.js.
9
+ */
10
+ /* global process */
11
+
12
+ import { camelize } from 'vue'
13
+
14
+ const warned = new Set()
15
+
16
+ /**
17
+ * Add the prop names one component options object declares, following its
18
+ * `extends` and `mixins`.
19
+ *
20
+ * @param {object} options A component options object.
21
+ * @param {Set<string>} names The set to add camelCase prop names to.
22
+ * @param {number} depth Recursion guard.
23
+ */
24
+ function collect(options, names, depth) {
25
+ if (!options || typeof options !== 'object' || depth > 8) {
26
+ return
27
+ }
28
+ const props = options.props
29
+ if (Array.isArray(props)) {
30
+ props.forEach((name) => names.add(camelize(String(name))))
31
+ } else if (props && typeof props === 'object') {
32
+ Object.keys(props).forEach((name) => names.add(camelize(name)))
33
+ }
34
+ collect(options.extends, names, depth + 1)
35
+ if (Array.isArray(options.mixins)) {
36
+ options.mixins.forEach((mixin) => collect(mixin, names, depth + 1))
37
+ }
38
+ }
39
+
40
+ /**
41
+ * The prop names a component declares, or `null` when it takes every
42
+ * attribute itself and so must keep receiving all of them:
43
+ * - `inheritAttrs: false`: the component forwards `$attrs` on purpose;
44
+ * - a functional component without `props`: its attrs are its props;
45
+ * - an async component that has not resolved yet.
46
+ *
47
+ * @spec openspec/changes/dashboard-declared-widget-props/specs/dashboard-page/spec.md#requirement-a-dashboard-widget-receives-only-the-content-keys-it-declares
48
+ * @param {object|((...args: unknown[]) => unknown)|null} component A component definition.
49
+ * @return {Set<string>|null} camelCase prop names, or null for "all".
50
+ */
51
+ export function declaredPropNames(component) {
52
+ if (!component) {
53
+ return null
54
+ }
55
+ if (typeof component === 'function') {
56
+ if (!component.props) {
57
+ return null
58
+ }
59
+ const names = new Set()
60
+ collect({ props: component.props }, names, 0)
61
+ return names
62
+ }
63
+ if (typeof component !== 'object') {
64
+ return null
65
+ }
66
+ if (component.__asyncLoader) {
67
+ return component.__asyncResolved ? declaredPropNames(component.__asyncResolved) : null
68
+ }
69
+ const chain = [component, component.extends, ...(component.mixins || [])]
70
+ if (chain.some((options) => options && options.inheritAttrs === false)) {
71
+ return null
72
+ }
73
+ const names = new Set()
74
+ collect(component, names, 0)
75
+ return names
76
+ }
77
+
78
+ /**
79
+ * Keep the entries of `bindings` whose key `component` declares as a prop.
80
+ * A component for which {@link declaredPropNames} returns null gets every
81
+ * entry. A dropped key is warned about once outside production when the
82
+ * component has no `content` prop either, so the key reaches nothing.
83
+ *
84
+ * @spec openspec/changes/dashboard-declared-widget-props/specs/dashboard-page/spec.md#requirement-a-dashboard-widget-receives-only-the-content-keys-it-declares
85
+ * @param {object|((...args: unknown[]) => unknown)|null} component The component that will receive the bindings.
86
+ * @param {object} bindings The candidate bindings.
87
+ * @param {string} label Names the component in the warning (for example the widget type).
88
+ * @return {object} The bindings the component declares.
89
+ */
90
+ export function pickDeclaredProps(component, bindings, label) {
91
+ const declared = declaredPropNames(component)
92
+ if (!declared || !bindings || typeof bindings !== 'object') {
93
+ return bindings
94
+ }
95
+ const out = {}
96
+ for (const [key, value] of Object.entries(bindings)) {
97
+ if (declared.has(camelize(key))) {
98
+ out[key] = value
99
+ continue
100
+ }
101
+ if (process.env.NODE_ENV !== 'production' && !declared.has('content') && !warned.has(`${label}\u0000${key}`)) {
102
+ warned.add(`${label}\u0000${key}`)
103
+ // eslint-disable-next-line no-console
104
+ console.warn(`[nextcloud-vue] content key "${key}" is not passed to widget "${label}": it declares neither that prop nor \`content\`.`)
105
+ }
106
+ }
107
+ return out
108
+ }
109
+
110
+ /**
111
+ * Forget which keys were warned about. For tests.
112
+ */
113
+ export function resetDeclaredPropWarnings() {
114
+ warned.clear()
115
+ }
@@ -64,8 +64,11 @@ export function readGridGeometry(items) {
64
64
  * full-width card under the stat tiles landed below the lists.
65
65
  *
66
66
  * @spec openspec/changes/dashboard-growth-keeps-order/specs/dashboard-grid/spec.md#requirement-a-growing-cell-keeps-the-order-of-the-cards-under-it
67
- * @param {Array<{x: number, y: number, w: number, h: number}>} nodes The grid's items (the growing one among them).
68
- * @param {{x: number, y: number, w: number, h: number}} node The growing item.
67
+ * The growing item is never among the items it moves, also when `nodes`
68
+ * holds another reference to it (a proxy of the same node, matched by `el`).
69
+ *
70
+ * @param {Array<{x: number, y: number, w: number, h: number, el: (HTMLElement|undefined)}>} nodes The grid's items (the growing one among them).
71
+ * @param {{x: number, y: number, w: number, h: number, el: (HTMLElement|undefined)}} node The growing item.
69
72
  * @param {number} h Its new height, in grid rows.
70
73
  * @return {Array<{node: object, y: number}>} The items to move and their new row, bottom-most first.
71
74
  */
@@ -80,7 +83,8 @@ export function planGrowth(nodes, node, h) {
80
83
  while (queue.length > 0) {
81
84
  const rect = queue.shift()
82
85
  for (const other of nodes) {
83
- if (other === node || moved.has(other) || !overlaps(rect, other)) {
86
+ const self = other === node || (node.el && other.el === node.el)
87
+ if (self || moved.has(other) || !overlaps(rect, other)) {
84
88
  continue
85
89
  }
86
90
  const next = { x: other.x, y: other.y + delta, w: other.w, h: other.h }