scb-wc-test 0.1.109 → 0.1.111

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.
@@ -631,7 +631,7 @@
631
631
  bySource.get(r.from).push(r);
632
632
  }
633
633
 
634
- /* Registrerar en global listener per käll-event.
634
+ /* Registrerar en global listener per source event.
635
635
  Varje listener hittar relevant komponent och triggar rätt normaliserat event. */
636
636
  bySource.forEach((rules, fromEvent) => {
637
637
  document.addEventListener(
@@ -1087,23 +1087,34 @@ window.SCBBlazor.getState = function () {
1087
1087
  });
1088
1088
 
1089
1089
  const checkboxesState = Array.from(checkboxes).map((cb) => {
1090
- const anyCb = cb;
1091
- const checked =
1092
- typeof anyCb.checked === 'boolean'
1090
+ const anyCb = cb;
1091
+ const checked =
1092
+ typeof anyCb.checked === 'boolean'
1093
1093
  ? anyCb.checked
1094
1094
  : cb.hasAttribute('checked');
1095
- return !!checked;
1096
- });
1097
1095
 
1096
+ return {
1097
+ checked: !!checked,
1098
+ name: cb.getAttribute('name') || '',
1099
+ value: cb.getAttribute('value') || '',
1100
+ label: cb.getAttribute('label') || '',
1101
+ };
1102
+ });
1098
1103
 
1099
- // Switchar på sidan hämtas som bool beroende selected
1104
+ // Switchar på sidan hämtas som objekt med selected, name, value och label
1100
1105
  const switchesState = Array.from(switches).map((sw) => {
1101
1106
  const anySw = sw;
1102
1107
  const selected =
1103
1108
  typeof anySw.selected === 'boolean'
1104
1109
  ? anySw.selected
1105
1110
  : sw.hasAttribute('selected');
1106
- return !!selected;
1111
+
1112
+ return {
1113
+ selected: !!selected,
1114
+ name: sw.getAttribute('name') || '',
1115
+ value: sw.getAttribute('value') || '',
1116
+ label: sw.getAttribute('label') || '',
1117
+ };
1107
1118
  });
1108
1119
 
1109
1120
  // App bar, läser direkt från attributen
@@ -1447,11 +1458,25 @@ window.SCBBlazor.getState = function () {
1447
1458
  ? anyTf.error
1448
1459
  : tf.hasAttribute('error');
1449
1460
 
1461
+ const name = (
1462
+ anyTf.name ??
1463
+ tf.getAttribute('name') ??
1464
+ ''
1465
+ ).toString();
1466
+
1467
+ const id = (
1468
+ anyTf.id ??
1469
+ tf.getAttribute('id') ??
1470
+ ''
1471
+ ).toString();
1472
+
1450
1473
  return {
1451
1474
  value,
1452
1475
  label,
1453
1476
  supportingText,
1454
1477
  error,
1478
+ name,
1479
+ id,
1455
1480
  };
1456
1481
  });
1457
1482
 
@@ -1481,11 +1506,25 @@ window.SCBBlazor.getState = function () {
1481
1506
  ''
1482
1507
  ).toString();
1483
1508
 
1509
+ const name = (
1510
+ anyS.name ??
1511
+ s.getAttribute('name') ??
1512
+ ''
1513
+ ).toString();
1514
+
1515
+ const id = (
1516
+ anyS.id ??
1517
+ s.getAttribute('id') ??
1518
+ ''
1519
+ ).toString();
1520
+
1484
1521
  return {
1485
1522
  value,
1486
1523
  supportingText,
1487
1524
  fullScreen,
1488
1525
  size,
1526
+ name,
1527
+ id,
1489
1528
  };
1490
1529
  });
1491
1530
 
@@ -1920,3 +1959,559 @@ window.SCBBlazor.registerScbEventHandlers = function (dotNetRef) {
1920
1959
  });
1921
1960
  });
1922
1961
  };
1962
+
1963
+ /*
1964
+ Styrkommandon från Blazor.
1965
+ Dessa funktioner uppdaterar komponenternas state i DOM och triggar normaliserade events
1966
+ så att SCBBlazor.getState och registerScbEventHandlers kan uppdatera Blazor-modellen.
1967
+ */
1968
+ (function () {
1969
+ 'use strict';
1970
+
1971
+ function getByIndex(selector, index) {
1972
+ const list = document.querySelectorAll(selector);
1973
+ if (!list || list.length === 0) return null;
1974
+ const i = typeof index === 'number' ? index : parseInt(index, 10);
1975
+ if (Number.isNaN(i) || i < 0 || i >= list.length) return null;
1976
+ return list[i];
1977
+ }
1978
+
1979
+ function getById(id, selector) {
1980
+ if (!id) return null;
1981
+ const el = document.getElementById(String(id));
1982
+ if (!el) return null;
1983
+ if (selector && (!(el instanceof Element) || !el.matches(selector))) return null;
1984
+ return el;
1985
+ }
1986
+
1987
+ function toBool(value) {
1988
+ return !!value;
1989
+ }
1990
+
1991
+ function dispatchChange(el, name, detail) {
1992
+ if (!el) return;
1993
+ el.dispatchEvent(
1994
+ new CustomEvent(name, {
1995
+ bubbles: true,
1996
+ composed: true,
1997
+ detail: detail || {},
1998
+ }),
1999
+ );
2000
+ }
2001
+
2002
+ const api = (window.SCBBlazor = window.SCBBlazor || {});
2003
+
2004
+ // Header
2005
+
2006
+ api.setHeaderActiveTab = function (index) {
2007
+ const header = document.querySelector('scb-header');
2008
+ if (!header) return;
2009
+ const i = typeof index === 'number' ? index : parseInt(index, 10) || 0;
2010
+ try {
2011
+ header.activeTab = i;
2012
+ } catch (_) {}
2013
+ header.setAttribute('active-tab', String(i));
2014
+ dispatchChange(header, 'tabchange', { index: i });
2015
+ };
2016
+
2017
+ api.setHeaderDrawerOpen = function (open) {
2018
+ const header = document.querySelector('scb-header');
2019
+ if (!header) return;
2020
+ const isOpen = toBool(open);
2021
+ if (isOpen) header.setAttribute('drawer-open', '');
2022
+ else header.removeAttribute('drawer-open');
2023
+ dispatchChange(header, 'draweropen', { open: isOpen });
2024
+ };
2025
+
2026
+ api.setHeaderSearchText = function (text) {
2027
+ const header = document.querySelector('scb-header');
2028
+ if (!header) return;
2029
+ const value = text == null ? '' : String(text);
2030
+ try {
2031
+ header.searchText = value;
2032
+ } catch (_) {}
2033
+ if (value) header.setAttribute('search-text', value);
2034
+ else header.removeAttribute('search-text');
2035
+ dispatchChange(header, 'search', { value });
2036
+ };
2037
+
2038
+ // Drawer och menu
2039
+
2040
+ api.setDrawerOpen = function (open) {
2041
+ const drawer = document.querySelector('scb-drawer');
2042
+ if (!drawer) return;
2043
+ const isOpen = toBool(open);
2044
+ try {
2045
+ drawer.open = isOpen;
2046
+ } catch (_) {}
2047
+ if (isOpen) drawer.setAttribute('open', '');
2048
+ else drawer.removeAttribute('open');
2049
+ dispatchChange(drawer, 'openchange', { open: isOpen });
2050
+ };
2051
+
2052
+ api.setDrawerText = function (label, subLabel) {
2053
+ const drawer = document.querySelector('scb-drawer');
2054
+ if (!drawer) return;
2055
+ const l = label == null ? '' : String(label);
2056
+ const s = subLabel == null ? '' : String(subLabel);
2057
+ drawer.setAttribute('label', l);
2058
+ drawer.setAttribute('sub-label', s);
2059
+ };
2060
+
2061
+ api.setMenuOpen = function (open) {
2062
+ const menu = document.querySelector('scb-menu');
2063
+ if (!menu) return;
2064
+ const isOpen = toBool(open);
2065
+ try {
2066
+ menu.open = isOpen;
2067
+ } catch (_) {}
2068
+ if (isOpen) menu.setAttribute('open', '');
2069
+ else menu.removeAttribute('open');
2070
+ dispatchChange(menu, 'openchange', { open: isOpen });
2071
+ };
2072
+
2073
+ api.setSubMenuOpen = function (index, open) {
2074
+ const subMenu = getByIndex('scb-sub-menu', index);
2075
+ if (!subMenu) return;
2076
+ const isOpen = toBool(open);
2077
+ try {
2078
+ subMenu.open = isOpen;
2079
+ } catch (_) {}
2080
+ if (isOpen) subMenu.setAttribute('open', '');
2081
+ else subMenu.removeAttribute('open');
2082
+ dispatchChange(subMenu, 'openchange', { open: isOpen });
2083
+ };
2084
+
2085
+ api.setSubMenuOpenById = function (id, open) {
2086
+ const subMenu = getById(id, 'scb-sub-menu');
2087
+ if (!subMenu) return;
2088
+ const isOpen = toBool(open);
2089
+ try {
2090
+ subMenu.open = isOpen;
2091
+ } catch (_) {}
2092
+ if (isOpen) subMenu.setAttribute('open', '');
2093
+ else subMenu.removeAttribute('open');
2094
+ dispatchChange(subMenu, 'openchange', { open: isOpen });
2095
+ };
2096
+
2097
+ // Breadcrumb
2098
+
2099
+ api.setBreadcrumbShowAll = function (showAll) {
2100
+ const breadcrumb = document.querySelector('scb-breadcrumb');
2101
+ if (!breadcrumb) return;
2102
+ const value = toBool(showAll);
2103
+ try {
2104
+ breadcrumb.showAll = value;
2105
+ } catch (_) {}
2106
+ if (value) breadcrumb.setAttribute('show-all', '');
2107
+ else breadcrumb.removeAttribute('show-all');
2108
+ dispatchChange(breadcrumb, 'showallchange', { value });
2109
+ };
2110
+
2111
+ // Accordion
2112
+
2113
+ api.setAccordionItemOpen = function (accordionIndex, itemIndex, open) {
2114
+ const acc = getByIndex('scb-accordion', accordionIndex);
2115
+ if (!acc) return;
2116
+ const items = acc.querySelectorAll('scb-accordion-item');
2117
+ if (!items || items.length === 0) return;
2118
+ const i = typeof itemIndex === 'number' ? itemIndex : parseInt(itemIndex, 10) || 0;
2119
+ if (i < 0 || i >= items.length) return;
2120
+ const item = items[i];
2121
+ const isOpen = toBool(open);
2122
+ try {
2123
+ item.open = isOpen;
2124
+ } catch (_) {}
2125
+ if (isOpen) item.setAttribute('open', '');
2126
+ else item.removeAttribute('open');
2127
+ dispatchChange(item, 'openchange', { open: isOpen });
2128
+ };
2129
+
2130
+ api.setAccordionItemOpenById = function (itemId, open) {
2131
+ const item = getById(itemId, 'scb-accordion-item');
2132
+ if (!item) return;
2133
+ const isOpen = toBool(open);
2134
+ try {
2135
+ item.open = isOpen;
2136
+ } catch (_) {}
2137
+ if (isOpen) item.setAttribute('open', '');
2138
+ else item.removeAttribute('open');
2139
+ dispatchChange(item, 'openchange', { open: isOpen });
2140
+ };
2141
+
2142
+ // Checkbox och switch
2143
+
2144
+ api.setCheckboxChecked = function (index, checked) {
2145
+ const cb = getByIndex('scb-checkbox', index);
2146
+ if (!cb) return;
2147
+ const isChecked = toBool(checked);
2148
+ try {
2149
+ cb.checked = isChecked;
2150
+ } catch (_) {}
2151
+ if (isChecked) cb.setAttribute('checked', '');
2152
+ else cb.removeAttribute('checked');
2153
+ dispatchChange(cb, 'checkedchange', { checked: isChecked });
2154
+ };
2155
+
2156
+ api.setCheckboxCheckedById = function (id, checked) {
2157
+ const cb = getById(id, 'scb-checkbox');
2158
+ if (!cb) return;
2159
+ const isChecked = toBool(checked);
2160
+ try {
2161
+ cb.checked = isChecked;
2162
+ } catch (_) {}
2163
+ if (isChecked) cb.setAttribute('checked', '');
2164
+ else cb.removeAttribute('checked');
2165
+ dispatchChange(cb, 'checkedchange', { checked: isChecked });
2166
+ };
2167
+
2168
+ api.setSwitchSelected = function (index, selected) {
2169
+ const sw = getByIndex('scb-switch', index);
2170
+ if (!sw) return;
2171
+ const isSelected = toBool(selected);
2172
+ try {
2173
+ sw.selected = isSelected;
2174
+ } catch (_) {}
2175
+ if (isSelected) sw.setAttribute('selected', '');
2176
+ else sw.removeAttribute('selected');
2177
+ dispatchChange(sw, 'selectedchange', { selected: isSelected });
2178
+ };
2179
+
2180
+ api.setSwitchSelectedById = function (id, selected) {
2181
+ const sw = getById(id, 'scb-switch');
2182
+ if (!sw) return;
2183
+ const isSelected = toBool(selected);
2184
+ try {
2185
+ sw.selected = isSelected;
2186
+ } catch (_) {}
2187
+ if (isSelected) sw.setAttribute('selected', '');
2188
+ else sw.removeAttribute('selected');
2189
+ dispatchChange(sw, 'selectedchange', { selected: isSelected });
2190
+ };
2191
+
2192
+ // Segmented button
2193
+
2194
+ api.setSegmentedValue = function (value) {
2195
+ const seg = document.querySelector('scb-segmented-button');
2196
+ if (!seg) return;
2197
+ const v = value == null ? '' : String(value);
2198
+ try {
2199
+ seg.value = v;
2200
+ } catch (_) {}
2201
+ if (v) seg.setAttribute('value', v);
2202
+ else seg.removeAttribute('value');
2203
+ dispatchChange(seg, 'valuechange', { value: v });
2204
+ };
2205
+
2206
+ api.setSegmentedValues = function (values) {
2207
+ const seg = document.querySelector('scb-segmented-button');
2208
+ if (!seg) return;
2209
+ const arr = Array.isArray(values) ? values.map((v) => String(v)) : [];
2210
+ try {
2211
+ seg.values = arr;
2212
+ } catch (_) {}
2213
+ if (arr.length > 0) {
2214
+ seg.setAttribute('value', arr[0]);
2215
+ } else {
2216
+ seg.removeAttribute('value');
2217
+ }
2218
+ dispatchChange(seg, 'valueschange', { values: arr });
2219
+ };
2220
+
2221
+ api.setSegmentedValueById = function (id, value) {
2222
+ const seg = getById(id, 'scb-segmented-button');
2223
+ if (!seg) return;
2224
+ const v = value == null ? '' : String(value);
2225
+ try {
2226
+ seg.value = v;
2227
+ } catch (_) {}
2228
+ if (v) seg.setAttribute('value', v);
2229
+ else seg.removeAttribute('value');
2230
+ dispatchChange(seg, 'valuechange', { value: v });
2231
+ };
2232
+
2233
+ api.setSegmentedValuesById = function (id, values) {
2234
+ const seg = getById(id, 'scb-segmented-button');
2235
+ if (!seg) return;
2236
+ const arr = Array.isArray(values) ? values.map((v) => String(v)) : [];
2237
+ try {
2238
+ seg.values = arr;
2239
+ } catch (_) {}
2240
+ if (arr.length > 0) {
2241
+ seg.setAttribute('value', arr[0]);
2242
+ } else {
2243
+ seg.removeAttribute('value');
2244
+ }
2245
+ dispatchChange(seg, 'valueschange', { values: arr });
2246
+ };
2247
+
2248
+ // Tabs
2249
+
2250
+ api.setTabsActiveIndex = function (tabsIndex, activeIndex) {
2251
+ const tabs = getByIndex('scb-tabs', tabsIndex);
2252
+ if (!tabs) return;
2253
+ const i = typeof activeIndex === 'number' ? activeIndex : parseInt(activeIndex, 10) || 0;
2254
+ const anyTabs = tabs;
2255
+ try {
2256
+ anyTabs.activeTabIndex = i;
2257
+ } catch (_) {}
2258
+ tabs.setAttribute('active-tab-index', String(i));
2259
+ dispatchChange(tabs, 'tabschange', { activeIndex: i });
2260
+ };
2261
+
2262
+ api.setTabsActiveIndexById = function (id, activeIndex) {
2263
+ const tabs = getById(id, 'scb-tabs');
2264
+ if (!tabs) return;
2265
+ const i = typeof activeIndex === 'number' ? activeIndex : parseInt(activeIndex, 10) || 0;
2266
+ const anyTabs = tabs;
2267
+ try {
2268
+ anyTabs.activeTabIndex = i;
2269
+ } catch (_) {}
2270
+ tabs.setAttribute('active-tab-index', String(i));
2271
+ dispatchChange(tabs, 'tabschange', { activeIndex: i });
2272
+ };
2273
+
2274
+ // Dialog, notification och snackbar
2275
+
2276
+ api.setDialogOpen = function (open) {
2277
+ const dialog = document.querySelector('scb-dialog');
2278
+ if (!dialog) return;
2279
+ const isOpen = toBool(open);
2280
+ try {
2281
+ dialog.open = isOpen;
2282
+ } catch (_) {}
2283
+ if (isOpen) dialog.setAttribute('open', '');
2284
+ else dialog.removeAttribute('open');
2285
+ dispatchChange(dialog, 'openchange', { open: isOpen });
2286
+ };
2287
+
2288
+ api.setNotificationOpen = function (index, open) {
2289
+ const card = getByIndex('scb-notification-card', index);
2290
+ if (!card) return;
2291
+ const isOpen = toBool(open);
2292
+ if (isOpen) card.setAttribute('open', '');
2293
+ else card.removeAttribute('open');
2294
+ dispatchChange(card, 'openchange', { open: isOpen });
2295
+ };
2296
+
2297
+ api.setNotificationOpenById = function (id, open) {
2298
+ const card = getById(id, 'scb-notification-card');
2299
+ if (!card) return;
2300
+ const isOpen = toBool(open);
2301
+ if (isOpen) card.setAttribute('open', '');
2302
+ else card.removeAttribute('open');
2303
+ dispatchChange(card, 'openchange', { open: isOpen });
2304
+ };
2305
+
2306
+ api.setSnackbarOpen = function (index, open) {
2307
+ const sb = getByIndex('scb-snackbar', index);
2308
+ if (!sb) return;
2309
+ const isOpen = toBool(open);
2310
+ if (isOpen) sb.setAttribute('open', '');
2311
+ else sb.removeAttribute('open');
2312
+ dispatchChange(sb, 'openchange', { open: isOpen });
2313
+ };
2314
+
2315
+ api.setSnackbarOpenById = function (id, open) {
2316
+ const sb = getById(id, 'scb-snackbar');
2317
+ if (!sb) return;
2318
+ const isOpen = toBool(open);
2319
+ if (isOpen) sb.setAttribute('open', '');
2320
+ else sb.removeAttribute('open');
2321
+ dispatchChange(sb, 'openchange', { open: isOpen });
2322
+ };
2323
+
2324
+ // Stepper och pagination
2325
+
2326
+ api.setStepperActiveIndex = function (activeIndex) {
2327
+ const stepper = document.querySelector('scb-stepper');
2328
+ if (!stepper) return;
2329
+ const i = typeof activeIndex === 'number' ? activeIndex : parseInt(activeIndex, 10) || 0;
2330
+ const anyStepper = stepper;
2331
+ try {
2332
+ anyStepper.activeIndex = i;
2333
+ } catch (_) {}
2334
+ stepper.setAttribute('active-index', String(i));
2335
+ dispatchChange(stepper, 'stepchange', { activeIndex: i });
2336
+ };
2337
+
2338
+ api.setStepperActiveIndexById = function (id, activeIndex) {
2339
+ const stepper = getById(id, 'scb-stepper');
2340
+ if (!stepper) return;
2341
+ const i = typeof activeIndex === 'number' ? activeIndex : parseInt(activeIndex, 10) || 0;
2342
+ const anyStepper = stepper;
2343
+ try {
2344
+ anyStepper.activeIndex = i;
2345
+ } catch (_) {}
2346
+ stepper.setAttribute('active-index', String(i));
2347
+ dispatchChange(stepper, 'stepchange', { activeIndex: i });
2348
+ };
2349
+
2350
+ api.setPaginationPage = function (paginationIndex, page) {
2351
+ const p = getByIndex('scb-pagination', paginationIndex);
2352
+ if (!p) return;
2353
+ const i = typeof page === 'number' ? page : parseInt(page, 10) || 0;
2354
+ const anyP = p;
2355
+ try {
2356
+ anyP.page = i;
2357
+ } catch (_) {}
2358
+ p.setAttribute('page', String(i));
2359
+ dispatchChange(p, 'pagechange', { page: i });
2360
+ };
2361
+
2362
+ api.setPaginationPageById = function (id, page) {
2363
+ const p = getById(id, 'scb-pagination');
2364
+ if (!p) return;
2365
+ const i = typeof page === 'number' ? page : parseInt(page, 10) || 0;
2366
+ const anyP = p;
2367
+ try {
2368
+ anyP.page = i;
2369
+ } catch (_) {}
2370
+ p.setAttribute('page', String(i));
2371
+ dispatchChange(p, 'pagechange', { page: i });
2372
+ };
2373
+
2374
+ // Radio group
2375
+
2376
+ api.setRadioGroupValueByIndex = function (groupIndex, value) {
2377
+ const group = getByIndex('scb-radio-group', groupIndex);
2378
+ if (!group) return;
2379
+ const v = value == null ? '' : String(value);
2380
+ try {
2381
+ group.value = v;
2382
+ } catch (_) {}
2383
+ group.setAttribute('value', v);
2384
+ dispatchChange(group, 'valuechange', { value: v });
2385
+ };
2386
+
2387
+ api.setRadioGroupValueByName = function (name, value) {
2388
+ if (!name) return;
2389
+ const selector = 'scb-radio-group[name="' + String(name) + '"]';
2390
+ const group = document.querySelector(selector);
2391
+ if (!group) return;
2392
+ const v = value == null ? '' : String(value);
2393
+ try {
2394
+ group.value = v;
2395
+ } catch (_) {}
2396
+ group.setAttribute('value', v);
2397
+ dispatchChange(group, 'valuechange', { value: v });
2398
+ };
2399
+
2400
+ api.setRadioGroupValueById = function (id, value) {
2401
+ const group = getById(id, 'scb-radio-group');
2402
+ if (!group) return;
2403
+ const v = value == null ? '' : String(value);
2404
+ try {
2405
+ group.value = v;
2406
+ } catch (_) {}
2407
+ group.setAttribute('value', v);
2408
+ dispatchChange(group, 'valuechange', { value: v });
2409
+ };
2410
+
2411
+ // Textfield och search
2412
+
2413
+ api.setTextfieldValue = function (index, value) {
2414
+ const tf = getByIndex('scb-textfield', index);
2415
+ if (!tf) return;
2416
+ const v = value == null ? '' : String(value);
2417
+ const anyTf = tf;
2418
+ try {
2419
+ anyTf.value = v;
2420
+ } catch (_) {}
2421
+ tf.setAttribute('value', v);
2422
+ dispatchChange(tf, 'valuechange', { value: v });
2423
+ };
2424
+
2425
+ api.setTextfieldValueById = function (id, value) {
2426
+ const tf = getById(id, 'scb-textfield');
2427
+ if (!tf) return;
2428
+ const v = value == null ? '' : String(value);
2429
+ const anyTf = tf;
2430
+ try {
2431
+ anyTf.value = v;
2432
+ } catch (_) {}
2433
+ tf.setAttribute('value', v);
2434
+ dispatchChange(tf, 'valuechange', { value: v });
2435
+ };
2436
+
2437
+ api.setSearchValue = function (index, value) {
2438
+ const s = getByIndex('scb-search', index);
2439
+ if (!s) return;
2440
+ const v = value == null ? '' : String(value);
2441
+ const anyS = s;
2442
+ try {
2443
+ anyS.value = v;
2444
+ } catch (_) {}
2445
+ s.setAttribute('value', v);
2446
+ dispatchChange(s, 'valuechange', { value: v });
2447
+ };
2448
+
2449
+ api.setSearchValueById = function (id, value) {
2450
+ const s = getById(id, 'scb-search');
2451
+ if (!s) return;
2452
+ const v = value == null ? '' : String(value);
2453
+ const anyS = s;
2454
+ try {
2455
+ anyS.value = v;
2456
+ } catch (_) {}
2457
+ s.setAttribute('value', v);
2458
+ dispatchChange(s, 'valuechange', { value: v });
2459
+ };
2460
+
2461
+ // TOC
2462
+
2463
+ api.setTocItemExpanded = function (tocIndex, itemIndex, expanded) {
2464
+ const toc = getByIndex('scb-toc', tocIndex);
2465
+ if (!toc) return;
2466
+ const items = toc.querySelectorAll('scb-toc-item');
2467
+ if (!items || items.length === 0) return;
2468
+ const i = typeof itemIndex === 'number' ? itemIndex : parseInt(itemIndex, 10) || 0;
2469
+ if (i < 0 || i >= items.length) return;
2470
+ const item = items[i];
2471
+ const isExpanded = toBool(expanded);
2472
+ const anyItem = item;
2473
+ try {
2474
+ anyItem.expanded = isExpanded;
2475
+ } catch (_) {}
2476
+ if (isExpanded) item.setAttribute('expanded', '');
2477
+ else item.removeAttribute('expanded');
2478
+ dispatchChange(item, 'expandedchange', { expanded: isExpanded });
2479
+ };
2480
+
2481
+ api.setTocItemExpandedById = function (itemId, expanded) {
2482
+ const item = getById(itemId, 'scb-toc-item');
2483
+ if (!item) return;
2484
+ const isExpanded = toBool(expanded);
2485
+ const anyItem = item;
2486
+ try {
2487
+ anyItem.expanded = isExpanded;
2488
+ } catch (_) {}
2489
+ if (isExpanded) item.setAttribute('expanded', '');
2490
+ else item.removeAttribute('expanded');
2491
+ dispatchChange(item, 'expandedchange', { expanded: isExpanded });
2492
+ };
2493
+
2494
+ // Viz
2495
+
2496
+ api.setVizSelectedChip = function (index, selectedChip) {
2497
+ const viz = getByIndex('scb-viz', index);
2498
+ if (!viz) return;
2499
+ const value = selectedChip == null ? '' : String(selectedChip);
2500
+ const anyViz = viz;
2501
+ try {
2502
+ anyViz.selectedChip = value;
2503
+ } catch (_) {}
2504
+ dispatchChange(viz, 'valuechange', { value });
2505
+ };
2506
+
2507
+ api.setVizSelectedChipById = function (id, selectedChip) {
2508
+ const viz = getById(id, 'scb-viz');
2509
+ if (!viz) return;
2510
+ const value = selectedChip == null ? '' : String(selectedChip);
2511
+ const anyViz = viz;
2512
+ try {
2513
+ anyViz.selectedChip = value;
2514
+ } catch (_) {}
2515
+ dispatchChange(viz, 'valuechange', { value });
2516
+ };
2517
+ })();
@@ -189,7 +189,7 @@ import{a as y,n as c,i as x,E as b,x as u,t as w}from"../../vendor/vendor.js";im
189
189
  line-height: var(--scb-search-line-height);
190
190
 
191
191
  color: var(--md-sys-color-on-surface);
192
- background: var(--md-sys-color-surface);
192
+ background: transparent;
193
193
 
194
194
  position: relative;
195
195
  z-index: 1;
@@ -235,7 +235,7 @@ import{a as y,n as c,i as x,E as b,x as u,t as w}from"../../vendor/vendor.js";im
235
235
  left: 0;
236
236
  width: 100%;
237
237
  z-index: 10;
238
- background: var(--md-sys-color-surface);
238
+ background: var(--md-sys-color-surface-container-lowest);
239
239
  border: var(--stroke-border, 1px) solid var(--md-sys-color-outline);
240
240
  border-top: 0;
241
241
  border-radius: 0 0 var(--scb-search-open-radius) var(--scb-search-open-radius);