@txstate-mws/svelte-components 1.6.11 → 1.6.13

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.
@@ -4,18 +4,21 @@ declare class ElementQueries {
4
4
  refresh(): void;
5
5
  fullresync(): void;
6
6
  activate(): void;
7
- subscribe(el: HTMLElement, store?: WritableSubject<{
7
+ subscribe<S extends {
8
8
  width: number;
9
- }>): () => void;
9
+ }>(el: HTMLElement, store?: WritableSubject<S>): () => void;
10
10
  }
11
11
  export declare const elementqueries: ElementQueries;
12
- interface EqOpts {
13
- store: WritableSubject<{
14
- width: number;
15
- }>;
16
- }
17
- export declare function eq(el: HTMLElement, opts?: EqOpts): {
18
- update(opts?: EqOpts): void;
12
+ export declare function eq<S extends {
13
+ width: number;
14
+ } = {
15
+ width: number;
16
+ }>(el: HTMLElement, opts?: {
17
+ store: WritableSubject<S>;
18
+ }): {
19
+ update(opts?: {
20
+ store: WritableSubject<S>;
21
+ }): void;
19
22
  destroy(): void;
20
23
  };
21
24
  export {};
@@ -7,15 +7,15 @@ class ElementQueries {
7
7
  #subscribers = 0;
8
8
  #stores = new Map();
9
9
  #processwidths() {
10
- for (let i = 0; i < this.#watchlist.length; i++) {
10
+ for (const layer of this.#watchlist) {
11
11
  const widths = [];
12
12
  const attrs = [];
13
- for (let j = 0; j < this.#watchlist[i].length; j++) {
14
- widths.push(this.#watchlist[i][j].offsetWidth);
15
- attrs.push(this.#watchlist[i][j].getAttribute('data-eq'));
13
+ for (const el of layer) {
14
+ widths.push(el.offsetWidth);
15
+ attrs.push(el.getAttribute('data-eq'));
16
16
  }
17
- for (let j = 0; j < this.#watchlist[i].length; j++) {
18
- const el = this.#watchlist[i][j];
17
+ for (let j = 0; j < layer.length; j++) {
18
+ const el = layer[j];
19
19
  const w = widths[j];
20
20
  let attrstr = '';
21
21
  let finalw = 1600;
@@ -62,10 +62,10 @@ class ElementQueries {
62
62
  #gotoanchor() {
63
63
  // since we are dramatically resizing, we need to scroll to the proper place for an
64
64
  // anchor tag
65
- const m = document.location.hash.match(/^#([a-z][\w:.-]*)$/i);
65
+ const m = document.location.hash.match(/^#([a-z][a-zA-Z0-9_:.\-]*)$/iv);
66
66
  if (m) {
67
67
  const id = m[1];
68
- requestAnimationFrame(() => { (document.getElementById(id) || document.querySelector(`[name="${id}"]`))?.scrollIntoView(true); });
68
+ requestAnimationFrame(() => { (document.getElementById(id) ?? document.querySelector(`[name="${id}"]`))?.scrollIntoView(true); });
69
69
  }
70
70
  }
71
71
  fullresync() {
@@ -100,7 +100,7 @@ class ElementQueries {
100
100
  // instead of faithfully subscribing and unsubscribing, so we'll add a subscriber that can't be
101
101
  // decremented and it will stay activated forever
102
102
  activate() {
103
- this.#subscribers++;
103
+ this.#subscribers += 1;
104
104
  this.#activateRaw();
105
105
  }
106
106
  #deactivate() {
@@ -111,14 +111,15 @@ class ElementQueries {
111
111
  this.#hasInit = false;
112
112
  }
113
113
  subscribe(el, store) {
114
- this.#subscribers++;
114
+ this.#subscribers += 1;
115
115
  if (store)
116
116
  this.#stores.set(el, store);
117
117
  else
118
118
  this.#stores.delete(el);
119
119
  this.#activateRaw();
120
120
  return () => {
121
- if (--this.#subscribers === 0)
121
+ this.#subscribers -= 1;
122
+ if (this.#subscribers === 0)
122
123
  this.#deactivate();
123
124
  };
124
125
  }
@@ -1,17 +1,74 @@
1
1
  import type { SettableSubject } from '@txstate-mws/svelte-store';
2
- export type GlueAlignOpts = 'auto' | 'bottomleft' | 'bottomright' | 'topleft' | 'topright';
2
+ export type GlueAlignOpts = 'auto' | 'bottomleft' | 'bottomright' | 'topleft' | 'topright' | 'top' | 'bottom' | 'left' | 'right' | 'autoleft' | 'autoright' | 'topauto' | 'bottomauto' | 'automiddle' | 'middleauto' | 'middle';
3
3
  export interface GlueArgs<T extends GlueAlignStore = GlueAlignStore> {
4
- target: HTMLElement;
4
+ /**
5
+ * The HTML element to which the element should be glued. The target remains where
6
+ * it is; the element you placed the glue action on will become position: fixed and
7
+ * move to align with the target.
8
+ */
9
+ target?: HTMLElement;
10
+ /**
11
+ * How to align the element relative to the target.
12
+ *
13
+ * Corner alignments:
14
+ * - `topleft`: element's bottom-left corner meets target's top-left corner
15
+ * - `topright`: element's bottom-right corner meets target's top-right corner
16
+ * - `bottomleft`: element's top-left corner meets target's bottom-left corner
17
+ * - `bottomright`: element's top-right corner meets target's bottom-right corner
18
+ *
19
+ * Side alignments (centered on the midpoint of the side):
20
+ * - `top`: element centered above target
21
+ * - `bottom`: element centered below target
22
+ * - `left`: element centered to the left of target
23
+ * - `right`: element centered to the right of target
24
+ *
25
+ * Auto alignments (choose based on available viewport space):
26
+ * - `auto`: choose between all four corners
27
+ * - `autoleft`: choose between `topleft` and `bottomleft`
28
+ * - `autoright`: choose between `topright` and `bottomright`
29
+ * - `topauto`: choose between `topleft` and `topright`
30
+ * - `bottomauto`: choose between `bottomleft` and `bottomright`
31
+ * - `automiddle`: choose between `top` and `bottom`
32
+ * - `middleauto`: choose between `left` and `right`
33
+ * - `middle`: choose between `top`, `bottom`, `left`, and `right`, or with `cover` set to true, simply center over the target
34
+ *
35
+ * When `cover` is false (default), the element is placed adjacent to the target.
36
+ * When `cover` is true, the element overlaps the target from the aligned side.
37
+ *
38
+ * @default 'auto'
39
+ */
5
40
  align?: GlueAlignOpts;
41
+ /**
42
+ * Adjusts the alignment setting behavior such that now the element will cover the target.
43
+ */
6
44
  cover?: boolean;
45
+ /**
46
+ * A pixel margin between the element and the target. When used with `cover`, will reveal
47
+ * a gap's worth of pixels of the target.
48
+ */
7
49
  gap?: number;
50
+ /**
51
+ * When true, increases the parent element's `min-height` to account for
52
+ * the positioned element's size, preventing the parent from collapsing
53
+ * when its child becomes `position: fixed`. Ignored if the parent has
54
+ * `overflow-y: auto`. The original `min-height` is restored on destroy.
55
+ *
56
+ * @default false
57
+ */
8
58
  adjustparentheight?: boolean;
59
+ /**
60
+ * The store that contains information about the alignment of the element. With align
61
+ * set to `auto`, this will tell you quickly which alignment is currently active.
62
+ */
9
63
  store?: SettableSubject<T>;
10
64
  }
11
65
  export interface GlueAlignStore {
12
- valign: 'bottom' | 'top';
13
- halign: 'left' | 'right';
66
+ valign: 'bottom' | 'top' | 'center';
67
+ halign: 'left' | 'right' | 'center';
14
68
  }
69
+ /**
70
+ * Make this element `position: fixed` and move it around to align with the target element.
71
+ */
15
72
  export declare function glue(el: HTMLElement, { target, align, cover, gap, adjustparentheight, store }: GlueArgs): {
16
73
  update({ target: utarget, align: ualign, cover: ucover, gap: ugap, store: ustore }: GlueArgs): void;
17
74
  destroy(): void;
@@ -1,22 +1,23 @@
1
1
  import { watchForMutations } from '../util/index.js';
2
2
  import { equal } from 'txstate-utils';
3
+ /**
4
+ * Make this element `position: fixed` and move it around to align with the target element.
5
+ */
3
6
  export function glue(el, { target, align = 'auto', cover = false, gap = 0, adjustparentheight = false, store }) {
4
7
  let halign;
5
8
  let valign;
6
- const parent = el.offsetParent;
9
+ const parent = el.offsetParent instanceof HTMLElement ? el.offsetParent : undefined;
7
10
  const formerMinHeight = parent?.style.minHeight;
8
11
  if (target)
9
12
  el.style.position = 'fixed';
10
- function adjustParentHeight() {
13
+ function adjustParentHeight(elOffsetTop, elOffsetHeight, parentClientHeight, parentOverflowY) {
11
14
  if (!adjustparentheight)
12
15
  return;
13
- if (parent?.style.overflowY === 'auto')
16
+ if (parentOverflowY === 'auto')
14
17
  return;
15
- const minHeight = el.offsetTop + el.offsetHeight;
16
- if (minHeight > (parent?.clientHeight ?? 0)) {
17
- requestAnimationFrame(() => {
18
- parent.style.minHeight = String(minHeight) + 'px';
19
- });
18
+ const minHeight = elOffsetTop + elOffsetHeight;
19
+ if (minHeight > parentClientHeight) {
20
+ parent.style.minHeight = String(minHeight) + 'px';
20
21
  }
21
22
  }
22
23
  let lastrect;
@@ -34,13 +35,55 @@ export function glue(el, { target, align = 'auto', cover = false, gap = 0, adjus
34
35
  const rect = { left: tmpRect.left - fixedRect.left, right: document.documentElement.clientWidth - tmpRect.right - fixedRect.right, top: tmpRect.top - fixedRect.top, bottom: document.documentElement.clientHeight - tmpRect.bottom - fixedRect.bottom, width: tmpRect.width, height: tmpRect.height };
35
36
  if (equal(rect, lastrect))
36
37
  return;
38
+ lastrect = rect;
37
39
  let autoalign = align;
40
+ const leftright = rect.right > rect.left ? 'left' : 'right';
41
+ const topbottom = rect.bottom > rect.top ? 'bottom' : 'top';
38
42
  if (align === 'auto') {
39
- const leftright = rect.right > rect.left ? 'left' : 'right';
40
- const topbottom = rect.bottom > rect.top ? 'bottom' : 'top';
41
43
  autoalign = topbottom + leftright;
42
44
  }
45
+ else if (align === 'autoleft') {
46
+ autoalign = topbottom + 'left';
47
+ }
48
+ else if (align === 'autoright') {
49
+ autoalign = topbottom + 'right';
50
+ }
51
+ else if (align === 'topauto') {
52
+ autoalign = 'top' + leftright;
53
+ }
54
+ else if (align === 'bottomauto') {
55
+ autoalign = 'bottom' + leftright;
56
+ }
57
+ else if (align === 'automiddle') {
58
+ autoalign = topbottom;
59
+ }
60
+ else if (align === 'middleauto') {
61
+ autoalign = leftright;
62
+ }
63
+ else if (align === 'middle') {
64
+ if (cover) {
65
+ autoalign = 'middle';
66
+ }
67
+ else {
68
+ const maxSpace = Math.max(rect.top, rect.bottom, rect.left, rect.right);
69
+ if (maxSpace === rect.bottom)
70
+ autoalign = 'bottom';
71
+ else if (maxSpace === rect.top)
72
+ autoalign = 'top';
73
+ else if (maxSpace === rect.right)
74
+ autoalign = 'right';
75
+ else
76
+ autoalign = 'left';
77
+ }
78
+ }
43
79
  const targetHeight = rect.height;
80
+ const elRect = el.getBoundingClientRect();
81
+ const elWidth = elRect.width;
82
+ const elHeight = elRect.height;
83
+ const elOffsetTop = el.offsetTop;
84
+ const elOffsetHeight = el.offsetHeight;
85
+ const parentClientHeight = parent?.clientHeight ?? 0;
86
+ const parentOverflowY = parent?.style.overflowY;
44
87
  if (autoalign === 'bottomleft') {
45
88
  cancelAnimationFrame(timer);
46
89
  timer = requestAnimationFrame(() => {
@@ -48,7 +91,7 @@ export function glue(el, { target, align = 'auto', cover = false, gap = 0, adjus
48
91
  el.style.left = `${rect.left}px`;
49
92
  el.style.removeProperty('bottom');
50
93
  el.style.removeProperty('right');
51
- adjustParentHeight();
94
+ adjustParentHeight(elOffsetTop, elOffsetHeight, parentClientHeight, parentOverflowY);
52
95
  });
53
96
  valign = 'bottom';
54
97
  halign = 'left';
@@ -60,7 +103,7 @@ export function glue(el, { target, align = 'auto', cover = false, gap = 0, adjus
60
103
  el.style.removeProperty('left');
61
104
  el.style.removeProperty('bottom');
62
105
  el.style.right = `${rect.right}px`;
63
- adjustParentHeight();
106
+ adjustParentHeight(elOffsetTop, elOffsetHeight, parentClientHeight, parentOverflowY);
64
107
  });
65
108
  valign = 'bottom';
66
109
  halign = 'right';
@@ -72,7 +115,7 @@ export function glue(el, { target, align = 'auto', cover = false, gap = 0, adjus
72
115
  el.style.left = `${rect.left}px`;
73
116
  el.style.bottom = `${rect.bottom + (cover ? 0 : targetHeight) + gap}px`;
74
117
  el.style.removeProperty('right');
75
- adjustParentHeight();
118
+ adjustParentHeight(elOffsetTop, elOffsetHeight, parentClientHeight, parentOverflowY);
76
119
  });
77
120
  valign = 'top';
78
121
  halign = 'left';
@@ -84,14 +127,85 @@ export function glue(el, { target, align = 'auto', cover = false, gap = 0, adjus
84
127
  el.style.removeProperty('left');
85
128
  el.style.bottom = `${rect.bottom + (cover ? 0 : targetHeight) + gap}px`;
86
129
  el.style.right = `${rect.right}px`;
87
- adjustParentHeight();
130
+ adjustParentHeight(elOffsetTop, elOffsetHeight, parentClientHeight, parentOverflowY);
88
131
  });
89
132
  valign = 'top';
90
133
  halign = 'right';
91
134
  }
135
+ else if (autoalign === 'top') {
136
+ cancelAnimationFrame(timer);
137
+ timer = requestAnimationFrame(() => {
138
+ el.style.removeProperty('top');
139
+ el.style.left = `${rect.left + rect.width / 2 - elWidth / 2}px`;
140
+ el.style.bottom = `${rect.bottom + (cover ? 0 : targetHeight) + gap}px`;
141
+ el.style.removeProperty('right');
142
+ adjustParentHeight(elOffsetTop, elOffsetHeight, parentClientHeight, parentOverflowY);
143
+ });
144
+ valign = 'top';
145
+ halign = 'center';
146
+ }
147
+ else if (autoalign === 'bottom') {
148
+ cancelAnimationFrame(timer);
149
+ timer = requestAnimationFrame(() => {
150
+ el.style.top = `${rect.top + (cover ? 0 : targetHeight) + gap}px`;
151
+ el.style.left = `${rect.left + rect.width / 2 - elWidth / 2}px`;
152
+ el.style.removeProperty('bottom');
153
+ el.style.removeProperty('right');
154
+ adjustParentHeight(elOffsetTop, elOffsetHeight, parentClientHeight, parentOverflowY);
155
+ });
156
+ valign = 'bottom';
157
+ halign = 'center';
158
+ }
159
+ else if (autoalign === 'left') {
160
+ cancelAnimationFrame(timer);
161
+ timer = requestAnimationFrame(() => {
162
+ el.style.top = `${rect.top + rect.height / 2 - elHeight / 2}px`;
163
+ el.style.removeProperty('bottom');
164
+ if (cover) {
165
+ el.style.left = `${rect.left + gap}px`;
166
+ el.style.removeProperty('right');
167
+ }
168
+ else {
169
+ el.style.removeProperty('left');
170
+ el.style.right = `${rect.right + rect.width + gap}px`;
171
+ }
172
+ adjustParentHeight(elOffsetTop, elOffsetHeight, parentClientHeight, parentOverflowY);
173
+ });
174
+ valign = 'center';
175
+ halign = 'left';
176
+ }
177
+ else if (autoalign === 'right') {
178
+ cancelAnimationFrame(timer);
179
+ timer = requestAnimationFrame(() => {
180
+ el.style.top = `${rect.top + rect.height / 2 - elHeight / 2}px`;
181
+ el.style.removeProperty('bottom');
182
+ if (cover) {
183
+ el.style.removeProperty('left');
184
+ el.style.right = `${rect.right + gap}px`;
185
+ }
186
+ else {
187
+ el.style.left = `${rect.left + rect.width + gap}px`;
188
+ el.style.removeProperty('right');
189
+ }
190
+ adjustParentHeight(elOffsetTop, elOffsetHeight, parentClientHeight, parentOverflowY);
191
+ });
192
+ valign = 'center';
193
+ halign = 'right';
194
+ }
195
+ else if (autoalign === 'middle') {
196
+ cancelAnimationFrame(timer);
197
+ timer = requestAnimationFrame(() => {
198
+ el.style.top = `${rect.top + rect.height / 2 - elHeight / 2}px`;
199
+ el.style.left = `${rect.left + rect.width / 2 - elWidth / 2}px`;
200
+ el.style.removeProperty('bottom');
201
+ el.style.removeProperty('right');
202
+ adjustParentHeight(elOffsetTop, elOffsetHeight, parentClientHeight, parentOverflowY);
203
+ });
204
+ valign = 'center';
205
+ halign = 'center';
206
+ }
92
207
  store?.update(v => ({ ...v, valign, halign }));
93
208
  }
94
- // eslint-disable-next-line @typescript-eslint/unbound-method
95
209
  const { destroy: watchDestroy } = watchForMutations(reposition);
96
210
  document.addEventListener('scroll', reposition, { capture: true });
97
211
  return {
@@ -116,7 +230,7 @@ export function glue(el, { target, align = 'auto', cover = false, gap = 0, adjus
116
230
  destroy() {
117
231
  watchDestroy();
118
232
  document.removeEventListener('scroll', reposition);
119
- if (adjustparentheight) {
233
+ if (adjustparentheight && parent) {
120
234
  if (formerMinHeight)
121
235
  parent.style.minHeight = formerMinHeight;
122
236
  parent.style.removeProperty('min-height');
@@ -16,11 +16,11 @@ export function offset(el, config) {
16
16
  el.dispatchEvent(new CustomEvent('offset', { detail: current }));
17
17
  }
18
18
  let resolvedchange = config?.debounce ? debounced(lookforoffsetchange, config.debounce) : lookforoffsetchange;
19
- const offsetContainer = !config?.container ? document.body : (config.container === 'nearest' ? el.offsetParent ?? document.body : config.container);
19
+ const offsetContainer = !config?.container ? document.body : (config.container === 'nearest' ? el.offsetParent instanceof HTMLElement ? el.offsetParent : document.body : config.container);
20
20
  const { destroy, update } = watchForPositionChangeInContainer(el, offsetContainer, resolvedchange);
21
21
  return {
22
22
  update(newConfig) {
23
- const offsetContainer = !config?.container ? document.body : (config.container === 'nearest' ? el.offsetParent ?? document.body : config.container);
23
+ const offsetContainer = !config?.container ? document.body : (config.container === 'nearest' ? el.offsetParent instanceof HTMLElement ? el.offsetParent : document.body : config.container);
24
24
  if (newConfig?.debounce === true)
25
25
  newConfig.debounce = 100;
26
26
  if (newConfig?.store !== config?.store) {
@@ -6,5 +6,5 @@ export type SvelteHTMLActionType<P = any> = (node: HTMLElement, params?: P) => S
6
6
  export type HTMLActionEntry<P = any> = SvelteHTMLActionType<P> | [SvelteHTMLActionType<P>, P];
7
7
  export type SvelteSVGActionType<P = any> = (node: SVGElement, params?: P) => SvelteActionReturnType<P> | undefined;
8
8
  export type SVGActionEntry<P = any> = SvelteSVGActionType<P> | [SvelteSVGActionType<P>, P];
9
- export declare function passActions(node: HTMLElement, actions: HTMLActionEntry[]): SvelteActionReturnType<HTMLActionEntry[]>;
10
- export declare function passActions(node: SVGElement, actions: SVGActionEntry[]): SvelteActionReturnType<SVGActionEntry[]>;
9
+ export declare function passActions(node: HTMLElement, actions: HTMLActionEntry[] | undefined): SvelteActionReturnType<HTMLActionEntry[]>;
10
+ export declare function passActions(node: SVGElement, actions: SVGActionEntry[] | undefined): SvelteActionReturnType<SVGActionEntry[]>;
@@ -63,10 +63,10 @@ export function stickyfixed(el, config) {
63
63
  const cell = el.querySelector('th:last-child,td:last-child');
64
64
  if (cell) {
65
65
  const tstyle = window.getComputedStyle(table);
66
- extrawidth = tstyle.borderCollapse === 'collapse' ? parseInt(window.getComputedStyle(cell).borderRightWidth) : 0;
66
+ extrawidth = tstyle.borderCollapse === 'collapse' ? parseInt(window.getComputedStyle(cell).borderRightWidth, 10) : 0;
67
67
  }
68
68
  }
69
- const width = `${parseInt(window.getComputedStyle(spacer).width) + extrawidth}px`;
69
+ const width = `${parseInt(window.getComputedStyle(spacer).width, 10) + extrawidth}px`;
70
70
  elheight = spacer.offsetHeight;
71
71
  for (let i = 0; i < tds.length; i++)
72
72
  tds[i].style.width = widths[i];
@@ -126,7 +126,7 @@ export function stickyfixed(el, config) {
126
126
  lastOffsetParent = offsetParent;
127
127
  }
128
128
  const table = el.closest('table');
129
- const borderspacing = (table ? parseInt(window.getComputedStyle(table).borderSpacing) : 0);
129
+ const borderspacing = (table ? parseInt(window.getComputedStyle(table).borderSpacing, 10) : 0);
130
130
  scrollstart = offset[0].top + el.offsetTop;
131
131
  left = offset[0].left + (spacer.parentElement ? spacer.offsetLeft : el.offsetLeft);
132
132
  if (el.tagName === 'TR') {
@@ -1,29 +1,34 @@
1
- <script lang="ts">import { randomid } from 'txstate-utils';
2
- import { Store } from '@txstate-mws/svelte-store';
3
- import PopupMenu from './PopupMenu.svelte';
4
- export let buttonelement;
5
- export let items = [];
6
- export let menushown = false;
7
- export let value = undefined;
8
- export let align = 'auto';
9
- export let cover = false;
10
- export let showSelected = true;
11
- export let width = undefined;
12
- export let computedalign = new Store({ valign: 'bottom', halign: 'left' });
13
- export let gap = 0;
14
- export let adjustparentheight = false;
15
- export let usePortal = undefined;
16
- export let loading = false;
17
- export let hilited = undefined;
18
- export let menuid = randomid();
19
- export let emptyText = undefined;
20
- export let menuContainerClass = '';
21
- export let menuClass = '';
22
- export let menuItemClass = '';
23
- export let menuItemHilitedClass = '';
24
- export let menuItemSelectedClass = '';
25
- export let menuDividerClass = '';
26
- const usemenurole = true;
1
+ <script lang="ts">
2
+ import { randomid } from 'txstate-utils'
3
+ import { Store } from '@txstate-mws/svelte-store'
4
+ import type { GlueAlignOpts, GlueAlignStore } from '../actions'
5
+ import type { PopupMenuItem } from '../types'
6
+ import PopupMenu from './PopupMenu.svelte'
7
+
8
+ export let buttonelement: HTMLButtonElement
9
+ export let items: PopupMenuItem[] = []
10
+ export let menushown = false
11
+ export let value: string | undefined = undefined
12
+ export let align: GlueAlignOpts = 'auto'
13
+ export let cover = false
14
+ export let showSelected = true
15
+ export let width: string | undefined = undefined
16
+ export let computedalign = new Store<GlueAlignStore>({ valign: 'bottom', halign: 'left' })
17
+ export let gap = 0
18
+ export let adjustparentheight = false
19
+ export let usePortal: HTMLElement | true | undefined = undefined
20
+ export let loading = false
21
+ export let hilited: number | undefined = undefined
22
+ export let menuid = randomid()
23
+ export let emptyText: string | undefined = undefined
24
+ export let menuContainerClass = ''
25
+ export let menuClass = ''
26
+ export let menuItemClass = ''
27
+ export let menuItemHilitedClass = ''
28
+ export let menuItemSelectedClass = ''
29
+
30
+ const usemenurole = true
31
+
27
32
  </script>
28
33
 
29
34
  <PopupMenu
@@ -49,4 +54,4 @@ const usemenurole = true;
49
54
  {menuItemClass}
50
55
  {menuItemHilitedClass}
51
56
  {menuItemSelectedClass}
52
- {menuDividerClass}/>
57
+ />
@@ -1,11 +1,11 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  import { Store } from '@txstate-mws/svelte-store';
3
3
  import type { GlueAlignOpts, GlueAlignStore } from '../actions';
4
- import type { PopupMenuTypes } from '../types';
4
+ import type { PopupMenuItem } from '../types';
5
5
  declare const __propDef: {
6
6
  props: {
7
7
  buttonelement: HTMLButtonElement;
8
- items?: PopupMenuTypes[];
8
+ items?: PopupMenuItem[];
9
9
  menushown?: boolean;
10
10
  value?: string | undefined;
11
11
  align?: GlueAlignOpts;
@@ -25,7 +25,6 @@ declare const __propDef: {
25
25
  menuItemClass?: string;
26
26
  menuItemHilitedClass?: string;
27
27
  menuItemSelectedClass?: string;
28
- menuDividerClass?: string;
29
28
  };
30
29
  events: {
31
30
  [evt: string]: CustomEvent<any>;
@@ -1,14 +1,18 @@
1
1
  <!-- @component
2
2
  [`Card`](https://github.com/txstate-etc/svelte-components/blob/main/src/lib/components/Card.svelte)
3
3
  -->
4
- <script lang="ts">export let className = '';
5
- import { getContext } from 'svelte';
6
- import { resize, passActions } from '../actions';
7
- import { CARDLAYOUT } from '../types';
8
- export let use = [];
9
- const block = { element: undefined };
10
- const { registerBlock, gutter, recalculate } = getContext(CARDLAYOUT);
11
- const { width, order, linebreak } = registerBlock(block);
4
+ <script lang="ts">
5
+ export let className = ''
6
+ import { getContext } from 'svelte'
7
+ import { resize, passActions, type HTMLActionEntry } from '../actions'
8
+ import { CARDLAYOUT } from '../types'
9
+ import type { CardLayoutContext, Block } from '../types'
10
+
11
+ export let use: HTMLActionEntry[] = []
12
+
13
+ const block: Block = { element: undefined }
14
+ const { registerBlock, gutter, recalculate } = getContext<CardLayoutContext>(CARDLAYOUT)
15
+ const { width, order, linebreak } = registerBlock(block)
12
16
  </script>
13
17
 
14
18
  <li class="cardlayout-card {className}" bind:this={block.element} use:passActions={use} use:resize on:resize={recalculate} style="margin-bottom: {$gutter}px; width: {$width}; order: {$order};">