@swiftwc/ui 0.0.0-dev.40 → 0.0.0-dev.41

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.
@@ -20,24 +20,40 @@ const update = (path, node, overwrite = true) => {
20
20
  };
21
21
  const reflectSpawnedElement = (current, source) => {
22
22
  const { page: oldSv, toolBarConfig: oldToolbar } = new NavigationPath(current).hydrate(), { page: newSv, toolBarConfig: newToolbar } = new NavigationPath(source).hydrate();
23
- const oldVStack = oldSv?.querySelector(':scope>v-stack'), newVStack = newSv?.querySelector(':scope>v-stack'), oldBackBtn = oldToolbar?.at(0)?.querySelector('button'), newBackBtn = newToolbar?.at(0)?.querySelector('button');
24
- // pre replace list (always exist)
25
- const oldOpenedDetails = [...(oldVStack?.querySelectorAll('list-view details[open]>summary') ?? [])].map((item) => item.textContent.trim());
26
- // replace list (always exist)
27
- if (oldVStack && newVStack)
28
- oldVStack.replaceWith(newVStack);
29
- // post replace list (always exist)
23
+ const oldList = oldSv?.querySelector('list-view'), newList = newSv?.querySelector('list-view'), oldBackBtn = oldToolbar?.at(0)?.querySelector('button'), newBackBtn = newToolbar?.at(0)?.querySelector('button');
24
+ // pre replace list (always exists)
25
+ const oldOpenedDetails = [...(oldList?.querySelectorAll('list-view details[open]>summary') ?? [])].map((item) => item.textContent.trim());
26
+ // replace list (always exists)
27
+ if (oldList && newList)
28
+ oldList.replaceWith(newList);
29
+ // post replace list (always exists)
30
30
  for (const label of oldOpenedDetails)
31
- for (const summary of newVStack?.querySelectorAll('list-view details>summary') ?? [])
31
+ for (const summary of newList?.querySelectorAll('list-view details>summary') ?? [])
32
32
  if (summary.textContent.trim() === label) {
33
33
  summary.parentElement?.setAttribute('open', 'open');
34
34
  break;
35
35
  }
36
- // replace backbtns (always exist)
36
+ // replace backbtns (always exists)
37
37
  if (oldBackBtn && newBackBtn)
38
38
  oldBackBtn.replaceWith(newBackBtn);
39
- // overwrite navtitle (always exist)
39
+ // overwrite navtitle (always exists)
40
40
  oldSv?.setAttribute('navigation-inline-title', newSv?.getAttribute('navigation-inline-title') ?? '');
41
+ // replace search (if exists)
42
+ oldList?.style.setProperty('--list--sticky-block-size', newList?.style.getPropertyValue('--list--sticky-block-size') ?? '');
43
+ // replace search (if exists)
44
+ const oldSearch = oldSv?.querySelector('sticky-container'), newSearch = newSv?.querySelector('sticky-container');
45
+ // if already exists, DO NOTHING dont mess up the input element
46
+ if (newSearch) {
47
+ if (!oldSearch)
48
+ oldSv?.insertAdjacentHTML('afterend', `<sticky-container edge="navbar" style="order: -1" padding>
49
+ <v-stack spacing="0" alignment="fill">
50
+ <input is="search-view" placeholder="Search">
51
+ <button type="button">Filters</button>
52
+ </v-stack>
53
+ </sticky-container>`);
54
+ }
55
+ else
56
+ oldSearch?.remove();
41
57
  };
42
58
  const extractTagFromOption = (node) => {
43
59
  return ((node.getAttribute('value') ?? node.textContent?.trim()) || node.getAttribute('label')) ?? '';
@@ -166,7 +182,7 @@ export class PickerView extends FormAssociatedBase {
166
182
  const currentValueLabel = this.querySelector(':scope>label-view:not([slot])') ?? this.appendChild($(`<label-view></label-view>`, '>1'));
167
183
  // reset state
168
184
  currentValueLabel.setAttribute('system-image', 'dots-three'); // overwritten
169
- currentValueLabel.setAttribute('title', this.#currentValueLabel); // overwritten
185
+ currentValueLabel.setAttribute('title', this.#selection); //, this.#currentValueLabel) // overwritten
170
186
  // clear all siblings
171
187
  for (const el of this.querySelectorAll(':scope>:not([slot])'))
172
188
  if (currentValueLabel !== el)
@@ -202,7 +218,7 @@ export class PickerView extends FormAssociatedBase {
202
218
  el.remove();
203
219
  const currentValueLabel = menu.querySelector(':scope>label-view[slot=label]') ?? menu.appendChild($(`<label-view slot="label"></label-view>`, '>1'));
204
220
  currentValueLabel.setAttribute('system-image', 'dots-three'); // overwritten
205
- currentValueLabel.setAttribute('title', this.#currentValueLabel); // overwritten
221
+ currentValueLabel.setAttribute('title', this.#selection); //this.#currentValueLabel) // overwritten
206
222
  _a.#reflectButtons([...(this.#slots?.get('list')?.assignedElements() ?? [])], menu);
207
223
  break;
208
224
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swiftwc/ui",
3
- "version": "0.0.0-dev.40",
3
+ "version": "0.0.0-dev.41",
4
4
  "description": "Elegant SwiftUI-inspired web components for standalone web apps and web extensions.",
5
5
  "publishConfig": {
6
6
  "access": "public"