@skeletonlabs/skeleton 1.2.5 → 1.5.1

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 (45) hide show
  1. package/dist/components/Accordion/Accordion.svelte +2 -1
  2. package/dist/components/Accordion/Accordion.svelte.d.ts +2 -0
  3. package/dist/components/AppRail/AppRail.svelte +1 -1
  4. package/dist/components/AppRail/AppRail.svelte.d.ts +3 -3
  5. package/dist/components/AppRail/AppRailTile.svelte +9 -2
  6. package/dist/components/AppRail/AppRailTile.svelte.d.ts +5 -5
  7. package/dist/components/Autocomplete/Autocomplete.svelte +4 -1
  8. package/dist/components/Autocomplete/Autocomplete.svelte.d.ts +5 -3
  9. package/dist/components/Avatar/Avatar.svelte +10 -1
  10. package/dist/components/Avatar/Avatar.svelte.d.ts +2 -0
  11. package/dist/components/ListBox/ListBoxItem.svelte +1 -1
  12. package/dist/components/Tab/Tab.svelte +33 -1
  13. package/dist/components/Tab/TabGroup.svelte +3 -1
  14. package/dist/utilities/CodeBlock/CodeBlock.svelte +12 -5
  15. package/dist/utilities/CodeBlock/CodeBlock.svelte.d.ts +2 -0
  16. package/dist/utilities/Drawer/Drawer.svelte +3 -2
  17. package/dist/utilities/Drawer/Drawer.svelte.d.ts +1 -1
  18. package/dist/utilities/LightSwitch/LightSwitch.svelte +8 -2
  19. package/dist/utilities/LocalStorageStore/LocalStorageStore.js +4 -4
  20. package/dist/utilities/Popup/popup.d.ts +2 -2
  21. package/dist/utilities/Popup/popup.js +163 -212
  22. package/dist/utilities/Popup/types.d.ts +20 -12
  23. package/dist/utilities/Popup/types.js +0 -1
  24. package/dist/utilities/Toast/Toast.svelte +2 -2
  25. package/dist/utilities/Toast/Toast.svelte.d.ts +1 -1
  26. package/package.json +4 -1
  27. package/src/lib/styles/all.css +21 -9
  28. package/src/lib/styles/elements/breadcrumbs.css +10 -0
  29. package/src/lib/styles/elements/codeblocks.css +16 -0
  30. package/src/lib/styles/elements/forms.css +15 -0
  31. package/src/lib/styles/elements/lists.css +2 -3
  32. package/src/lib/styles/elements/popups.css +2 -2
  33. package/src/lib/styles/partials/elements.css +20 -0
  34. package/src/lib/styles/{typography.css → partials/typography-next.css} +33 -35
  35. package/src/lib/styles/partials/typography-prose.css +51 -0
  36. package/src/lib/styles/partials/typography.css +99 -0
  37. package/src/lib/styles/{variants.css → partials/variants.css} +53 -5
  38. package/src/lib/styles/skeleton-minimal.css +30 -0
  39. package/src/lib/styles/skeleton.css +30 -0
  40. package/src/lib/tailwind/generated/intellisense-classes.cjs +1 -1
  41. package/src/lib/tailwind/intellisense.cjs +2 -2
  42. package/src/lib/styles/elements.css +0 -19
  43. package/src/lib/styles/highlight-js.css +0 -116
  44. /package/src/lib/styles/{core.css → partials/core.css} +0 -0
  45. /package/src/lib/styles/{tailwind.css → partials/tailwind.css} +0 -0
@@ -1,46 +1,72 @@
1
1
  import { get, writable } from 'svelte/store';
2
- // Store
2
+ // Use a store to pass the Floating UI import references
3
3
  export const storePopup = writable(undefined);
4
- function isNode(node) {
5
- return node instanceof Node;
6
- }
7
- // Action
8
- export function popup(node, args) {
9
- if (!args.event || !args.target)
10
- return;
11
- // Local
12
- const { computePosition, autoUpdate, flip, shift, offset, arrow } = get(storePopup);
13
- const elemPopup = document.querySelector(`[data-popup="${args.target}"]`);
14
- const elemArrow = elemPopup?.querySelector(`.arrow`) ?? null;
15
- let isVisible = false;
16
- let autoUpdateCleanup;
17
- // Local A11y Variables
18
- const elemWhitelist = ':is(a[href], button, input, textarea, select, details, [tabindex]):not([tabindex="-1"])';
19
- let activeFocusIdx;
20
- let focusableElems;
21
- // On Init (floating ui)
4
+ export function popup(triggerNode, args) {
5
+ // Floating UI Modules
6
+ const { computePosition, autoUpdate, offset, shift, flip, arrow, size, autoPlacement, hide, inline } = get(storePopup);
7
+ // Local State
8
+ let popupState = {
9
+ open: false,
10
+ autoUpdateCleanup: () => { }
11
+ };
12
+ const focusableAllowedList = ':is(a[href], button, input, textarea, select, details, [tabindex]):not([tabindex="-1"])';
13
+ let focusablePoupupElements;
14
+ const documentationLink = 'https://www.skeleton.dev/utilities/popups';
15
+ // Elements
16
+ let elemPopup;
17
+ let elemArrow;
18
+ function setDomElements() {
19
+ elemPopup = document.querySelector(`[data-popup="${args.target}"]`) ?? document.createElement('div');
20
+ elemArrow = elemPopup?.querySelector(`.arrow`) ?? document.createElement('div');
21
+ }
22
+ setDomElements(); // init
23
+ // Render Floating UI Popup
22
24
  function render() {
23
- if (!elemPopup || !computePosition)
24
- return;
25
- // Construct Middleware
26
- // Note the order: https://floating-ui.com/docs/middleware#ordering
27
- const genMiddleware = [];
28
- // https://floating-ui.com/docs/offset
29
- if (offset)
30
- genMiddleware.push(offset(args.middleware?.offset ?? 8));
31
- // https://floating-ui.com/docs/shift
32
- if (shift)
33
- genMiddleware.push(shift(args.middleware?.shift ?? { padding: 8 }));
34
- // https://floating-ui.com/docs/flip
35
- if (flip)
36
- genMiddleware.push(flip(args.middleware?.flip));
37
- // https://floating-ui.com/docs/arrow
38
- if (arrow && elemArrow)
39
- genMiddleware.push(arrow(args.middleware?.arrow ?? { element: elemArrow }));
25
+ // Error handling for required Floating UI modules
26
+ if (!elemPopup)
27
+ throw new Error(`The data-popup="${args.target}" element was not found. ${documentationLink}`);
28
+ if (!computePosition)
29
+ throw new Error(`Floating UI 'computePosition' not found for data-popup="${args.target}". ${documentationLink}`);
30
+ if (!offset)
31
+ throw new Error(`Floating UI 'offset' not found for data-popup="${args.target}". ${documentationLink}`);
32
+ if (!shift)
33
+ throw new Error(`Floating UI 'shift' not found for data-popup="${args.target}". ${documentationLink}`);
34
+ if (!flip)
35
+ throw new Error(`Floating UI 'flip' not found for data-popup="${args.target}". ${documentationLink}`);
36
+ if (!arrow)
37
+ throw new Error(`Floating UI 'arrow' not found for data-popup="${args.target}". ${documentationLink}`);
38
+ // Bundle optional middlware
39
+ const optionalMiddlware = [];
40
+ // https://floating-ui.com/docs/size
41
+ if (size)
42
+ optionalMiddlware.push(size(args.middleware?.size));
43
+ // https://floating-ui.com/docs/autoPlacement
44
+ if (autoPlacement)
45
+ optionalMiddlware.push(autoPlacement(args.middleware?.autoPlacement));
46
+ // https://floating-ui.com/docs/hide
47
+ if (hide)
48
+ optionalMiddlware.push(hide(args.middleware?.hide));
49
+ // https://floating-ui.com/docs/inline
50
+ if (inline)
51
+ optionalMiddlware.push(inline(args.middleware?.inline));
52
+ // Floating UI Compute Position
40
53
  // https://floating-ui.com/docs/computePosition
41
- computePosition(node, elemPopup, {
54
+ computePosition(triggerNode, elemPopup, {
42
55
  placement: args.placement ?? 'bottom',
43
- middleware: genMiddleware
56
+ // Middleware - NOTE: the order matters:
57
+ // https://floating-ui.com/docs/middleware#ordering
58
+ middleware: [
59
+ // https://floating-ui.com/docs/offset
60
+ offset(args.middleware?.offset ?? 8),
61
+ // https://floating-ui.com/docs/shift
62
+ shift(args.middleware?.shift ?? { padding: 8 }),
63
+ // https://floating-ui.com/docs/flip
64
+ flip(args.middleware?.flip),
65
+ // https://floating-ui.com/docs/arrow
66
+ arrow(args.middleware?.arrow ?? { element: elemArrow || null }),
67
+ // Implement optional middlware
68
+ ...optionalMiddlware
69
+ ]
44
70
  }).then(({ x, y, placement, middlewareData }) => {
45
71
  Object.assign(elemPopup.style, {
46
72
  left: `${x}px`,
@@ -65,214 +91,139 @@ export function popup(node, args) {
65
91
  [staticSide]: '-4px'
66
92
  });
67
93
  }
68
- // Set Focusable State
69
- setFocusableState();
70
- });
71
- }
72
- // Set Focusable State
73
- function setFocusableState() {
74
- if (!elemPopup)
75
- return;
76
- // Create array of all focusable elements, so that we can iterate through them
77
- focusableElems = Array.from(elemPopup?.querySelectorAll(elemWhitelist));
78
- // reset the focus index
79
- activeFocusIdx = -1;
80
- // Automatically focus the element if openWithFocus is true (for example if
81
- // the menu was opened with Enter instead of with a click
82
- activeFocusIdx = 0;
83
- // if the popup was triggered via focus, we don't want to move that focus
84
- if (args.event !== 'focus' && args.event !== 'focus-click') {
85
- focusableElems[0]?.focus();
86
- }
87
- }
88
- // Close popup if element matching closeQuery is clicked
89
- function closeOnQueryClick(clickedEl) {
90
- if (!clickedEl)
91
- return;
92
- const elemsCloseQuery = !args.closeQuery || args.closeQuery === '' ? 'a[href], button' : args.closeQuery;
93
- const interactiveMenuElems = elemPopup?.querySelectorAll(elemsCloseQuery);
94
- if (!interactiveMenuElems?.length)
95
- return;
96
- interactiveMenuElems.forEach((elem) => {
97
- if (elem.contains(clickedEl))
98
- close();
99
94
  });
100
95
  }
101
- // Window Click Handler
102
- const onWindowClick = (event) => {
103
- if (!node || !elemPopup)
104
- return;
105
- // If click is within the trigger node
106
- const clickTriggerNode = node.contains(event.target);
107
- if (clickTriggerNode) {
108
- isVisible == false ? show() : close();
109
- }
110
- else {
111
- // If click is outside the popup
112
- const clickedOutsidePopup = elemPopup && !elemPopup.contains(event.target);
113
- if (clickedOutsidePopup) {
114
- close();
115
- }
116
- else {
117
- closeOnQueryClick(event.target);
118
- }
119
- }
120
- };
121
- // Hover Handlers
122
- const onMouseOver = () => {
123
- show();
124
- isVisible = true;
125
- stateEventHandler(true);
126
- };
127
- const onMouseOut = () => {
128
- close();
129
- isVisible = false;
130
- stateEventHandler(false);
131
- };
132
- // Focus Handlers
133
- function onFocusIn() {
134
- if (!isVisible)
135
- node.focus();
136
- }
137
- function onFocusOut(e) {
138
- // if the focus is within the popup, or on the trigger node, do nothing
139
- if (e.relatedTarget instanceof Element && (elemPopup?.contains(e.relatedTarget) || node.isSameNode(e.relatedTarget)))
140
- return;
141
- close();
142
- }
143
- function onMouseDown(e) {
144
- e.preventDefault();
145
- if (isNode(document.activeElement)) {
146
- if (!node.isSameNode(document.activeElement)) {
147
- node.focus();
148
- return;
149
- }
150
- if (isVisible)
151
- close();
152
- else
153
- show();
154
- }
155
- }
156
- // Visibility
157
- function show() {
96
+ // State Handlers
97
+ function open() {
158
98
  if (!elemPopup)
159
99
  return;
160
- render(); // update
100
+ // Set open state to on
101
+ popupState.open = true;
102
+ // Return the current state
103
+ if (args.state)
104
+ args.state({ state: popupState.open });
105
+ // Update render settings
106
+ render();
107
+ // Update the DOM
161
108
  elemPopup.style.display = 'block';
162
109
  elemPopup.style.opacity = '1';
163
- isVisible = true;
164
- stateEventHandler(true);
165
- // Utilize autoUpdate ONLY when the popup is.
110
+ elemPopup.style.pointerEvents = 'auto';
111
+ // Trigger Floating UI autoUpdate (open only)
166
112
  // https://floating-ui.com/docs/autoUpdate
167
- autoUpdateCleanup = autoUpdate(node, elemPopup, render);
113
+ popupState.autoUpdateCleanup = autoUpdate(triggerNode, elemPopup, render);
114
+ // Focus the first focusable element within the popup
115
+ focusablePoupupElements = Array.from(elemPopup?.querySelectorAll(focusableAllowedList));
168
116
  }
169
- function close() {
117
+ function close(callback) {
170
118
  if (!elemPopup)
171
119
  return;
172
- elemPopup.style.opacity = '0';
120
+ // Set transition duration
173
121
  const cssTransitionDuration = parseFloat(window.getComputedStyle(elemPopup).transitionDuration.replace('s', '')) * 1000;
174
122
  setTimeout(() => {
175
- elemPopup.style.display = 'none';
176
- isVisible = false;
177
- stateEventHandler(false);
123
+ // Set open state to off
124
+ popupState.open = false;
125
+ // Return the current state
126
+ if (args.state)
127
+ args.state({ state: popupState.open });
128
+ // Update the DOM
129
+ elemPopup.style.opacity = '0';
130
+ elemPopup.style.pointerEvents = 'none';
131
+ // Cleanup Floating UI autoUpdate (close only)
132
+ if (popupState.autoUpdateCleanup)
133
+ popupState.autoUpdateCleanup();
134
+ // Trigger callback
135
+ if (callback)
136
+ callback();
178
137
  }, cssTransitionDuration);
179
- // Cleanup autoUpdate on close (REQUIRED)
180
- if (autoUpdateCleanup)
181
- autoUpdateCleanup();
182
138
  }
183
- // State Handler
184
- const stateEventHandler = (value) => {
185
- if (args.state)
186
- args.state({ state: value });
187
- };
188
- // A11y Keydown Handler
139
+ // Event Handlers
140
+ function toggle() {
141
+ popupState.open === false ? open() : close();
142
+ }
143
+ function onWindowClick(event) {
144
+ // Return if the popup is not yet open
145
+ if (popupState.open === false)
146
+ return;
147
+ // Return if click is the trigger element
148
+ if (triggerNode.contains(event.target))
149
+ return;
150
+ // If click it outside the popup
151
+ if (elemPopup && elemPopup.contains(event.target) === false) {
152
+ close();
153
+ return;
154
+ }
155
+ // Handle Close Query State
156
+ const closeQueryString = args.closeQuery === undefined ? 'a[href], button' : args.closeQuery;
157
+ const closableMenuElements = elemPopup?.querySelectorAll(closeQueryString);
158
+ closableMenuElements?.forEach((elem) => {
159
+ if (elem.contains(event.target))
160
+ close();
161
+ });
162
+ }
163
+ // Keyboard Interactions for A11y
189
164
  const onWindowKeyDown = (event) => {
190
- if (!isVisible)
165
+ if (popupState.open === false)
191
166
  return;
192
167
  // Handle keys
193
168
  const key = event.key;
194
- // Handle keyboard interaction
195
- if (key === 'Escape' || (document.activeElement === node && key === 'Tab')) {
169
+ // On Esc key
170
+ if (key === 'Escape') {
196
171
  event.preventDefault();
172
+ triggerNode.focus();
197
173
  close();
198
- node.focus();
199
174
  return;
200
175
  }
201
- else if (key === 'ArrowDown') {
176
+ // On Tab or ArrowDown key
177
+ const triggerMenuFocused = popupState.open && document.activeElement === triggerNode;
178
+ if (triggerMenuFocused && (key === 'ArrowDown' || key === 'Tab')) {
202
179
  event.preventDefault();
203
- if (activeFocusIdx < focusableElems.length - 1) {
204
- // Move down the menu
205
- activeFocusIdx += 1;
206
- focusableElems[activeFocusIdx]?.focus();
207
- }
208
- }
209
- else if (key === 'ArrowUp') {
210
- event.preventDefault();
211
- if (activeFocusIdx > 0) {
212
- // Move up the menu
213
- activeFocusIdx -= 1;
214
- focusableElems[activeFocusIdx]?.focus();
215
- }
216
- else if (focusableElems.length && activeFocusIdx === -1) {
217
- // Start at the bottom of the menu if first key is arrow up key
218
- event.preventDefault();
219
- activeFocusIdx = focusableElems.length - 1;
220
- focusableElems[activeFocusIdx]?.focus();
221
- }
180
+ if (focusableAllowedList.length > 0)
181
+ focusablePoupupElements[0].focus();
222
182
  }
223
183
  };
224
- // On Init
225
- render();
226
184
  // Event Listeners
227
- if (args.event === 'click') {
228
- window.addEventListener('click', onWindowClick, true);
229
- }
230
- if (args.event === 'hover') {
231
- node.addEventListener('mouseover', show, true);
232
- node.addEventListener('mouseout', close, true);
185
+ switch (args.event) {
186
+ case 'click':
187
+ triggerNode.addEventListener('click', toggle, true);
188
+ window.addEventListener('click', onWindowClick, true);
189
+ break;
190
+ case 'hover':
191
+ triggerNode.addEventListener('mouseover', open, true);
192
+ triggerNode.addEventListener('mouseleave', close, true);
193
+ break;
194
+ case 'focus-blur':
195
+ triggerNode.addEventListener('focus', toggle, true);
196
+ triggerNode.addEventListener('blur', close, true);
197
+ break;
198
+ case 'focus-click':
199
+ triggerNode.addEventListener('focus', open, true);
200
+ window.addEventListener('click', onWindowClick, true);
201
+ break;
202
+ default:
203
+ throw new Error(`Event value of '${args.event}' is not supported. ${documentationLink}`);
233
204
  }
234
- if (args.event === 'hover-click') {
235
- node.addEventListener('mouseover', show, true);
236
- window.addEventListener('click', onWindowClick, true);
237
- }
238
- if (args.event === 'focus' || args.event === 'focus-click') {
239
- if (!elemPopup)
240
- return;
241
- node.addEventListener('focusin', show, true);
242
- node.addEventListener('focusout', onFocusOut, true);
243
- // if we tab into a closed popup, we will tab into the last element of any focusable element in elemPopup
244
- // so we add an event listener to move the focus back to the node the `use:popup` directive is on
245
- elemPopup.addEventListener('focusin', onFocusIn, true);
246
- // when we focus off the end of the list, close the popup
247
- elemPopup.addEventListener('focusout', onFocusOut, true);
248
- // when an element inside the popup is clicked, close the popup if the element matches the closeQuery
249
- elemPopup.addEventListener('click', onWindowClick, true);
250
- }
251
- if (args.event === 'focus-click') {
252
- // we must use mousedown instead of click because click fires after focusin, meaning isVisible would always be true
253
- // if the active element (one with current focus) is the same as the node (the element with the use:popup directive),
254
- // then the user clicked on the node, so we should toggle the state of the popup
255
- node.addEventListener('mousedown', onMouseDown, true);
256
- }
257
- // A11y Event Listeners
258
205
  window.addEventListener('keydown', onWindowKeyDown, true);
206
+ // Render popup on initilization
207
+ render();
259
208
  // Lifecycle
260
209
  return {
261
210
  update(newArgs) {
262
- args = newArgs;
263
- render();
211
+ close(() => {
212
+ args = newArgs;
213
+ render();
214
+ setDomElements();
215
+ });
264
216
  },
265
217
  destroy() {
266
- // ---
218
+ // Trigger Events
219
+ triggerNode.removeEventListener('click', toggle, true);
220
+ triggerNode.removeEventListener('mouseover', open, true);
221
+ triggerNode.removeEventListener('mouseleave', close, true);
222
+ triggerNode.removeEventListener('focus', toggle, true);
223
+ triggerNode.removeEventListener('focus', open, true);
224
+ triggerNode.removeEventListener('blur', close, true);
225
+ // Window Events
267
226
  window.removeEventListener('click', onWindowClick, true);
268
- node.removeEventListener('mouseover', onMouseOver, true);
269
- node.removeEventListener('mouseout', onMouseOut, true);
270
- node.removeEventListener('focusin', show, true);
271
- node.removeEventListener('focusout', onFocusOut, true);
272
- node.removeEventListener('mousedown', onMouseDown, true);
273
- elemPopup?.removeEventListener('focusin', onFocusIn, true);
274
- elemPopup?.removeEventListener('focusout', onFocusOut, true);
275
- // ---
276
227
  window.removeEventListener('keydown', onWindowKeyDown, true);
277
228
  }
278
229
  };
@@ -1,32 +1,40 @@
1
- type Direction = 'top' | 'bottom' | 'left' | 'right';
2
1
  /** Placement https://floating-ui.com/docs/computePosition#placement */
2
+ type Direction = 'top' | 'bottom' | 'left' | 'right';
3
3
  type Placement = Direction | `${Direction}-start` | `${Direction}-end`;
4
- interface Middleware {
5
- /** Offset options: https://floating-ui.com/docs/offset */
4
+ export interface Middleware {
5
+ /** Offset middleware settings: https://floating-ui.com/docs/offset */
6
6
  offset?: number | Record<string, any>;
7
- /** Shift options: https://floating-ui.com/docs/shift */
7
+ /** Shift middleware settings: https://floating-ui.com/docs/shift */
8
8
  shift?: Record<string, any>;
9
- /** Flip options: https://floating-ui.com/docs/flip */
9
+ /** Flip middleware settings: https://floating-ui.com/docs/flip */
10
10
  flip?: Record<string, any>;
11
- /** Arrow options: https://floating-ui.com/docs/arrow */
11
+ /** Arrow middleware settings: https://floating-ui.com/docs/arrow */
12
12
  arrow?: {
13
13
  element: string;
14
14
  } & Record<string, any>;
15
+ /** Size middleware settings: https://floating-ui.com/docs/size */
16
+ size?: Record<string, any>;
17
+ /** Auto Placement middleware settings: https://floating-ui.com/docs/autoPlacement */
18
+ autoPlacement?: Record<string, any>;
19
+ /** Hide middleware settings: https://floating-ui.com/docs/hide */
20
+ hide?: Record<string, any>;
21
+ /** Inline middleware settings: https://floating-ui.com/docs/inline */
22
+ inline?: Record<string, any>;
15
23
  }
16
24
  export interface PopupSettings {
17
25
  /** Provide the event type. */
18
- event: 'click' | 'hover' | 'hover-click' | 'focus' | 'focus-click';
19
- /** Match the popup data value `[data-popup]="targetNameHere"` */
26
+ event: 'click' | 'hover' | 'focus-blur' | 'focus-click';
27
+ /** Match the popup data value `data-popup="targetNameHere"` */
20
28
  target: string;
21
29
  /** Set the placement position. Defaults 'bottom'. */
22
30
  placement?: Placement;
23
- /** Query list of elements that will close the popup. Default: `'a[href], button'`. */
31
+ /** Query elements that close the popup when clicked. Defaults `'a[href], button'`. */
24
32
  closeQuery?: string;
25
- /** Provide additional options and middleware settings. */
26
- middleware?: Middleware;
27
- /** Provide an optional callback function to monitor open/close state. */
33
+ /** Optional callback function that reports state change. */
28
34
  state?: (event: {
29
35
  state: boolean;
30
36
  }) => void;
37
+ /** Provide Floating UI middleware settings. */
38
+ middleware?: Middleware;
31
39
  }
32
40
  export {};
@@ -1,3 +1,2 @@
1
1
  // Popup Types
2
- // Note: these are a simple iteration based on the official docs.
3
2
  export {};
@@ -98,9 +98,9 @@ const [send, receive] = crossfade({
98
98
  <!-- Wrapper -->
99
99
  <div class="snackbar-wrapper {classesWrapper}" data-testid="snackbar-wrapper">
100
100
  <!-- List -->
101
- <div class="snackbar {classesSnackbar}" >
101
+ <div class="snackbar {classesSnackbar}">
102
102
  {#each filteredToasts as t, i (t)}
103
- <div animate:flip={{ duration }} in:receive="{{key: t.id}}" out:send="{{key: t.id}}">
103
+ <div animate:flip={{ duration }} in:receive={{ key: t.id }} out:send={{ key: t.id }}>
104
104
  <!-- Toast -->
105
105
  <div class="toast {classesToast} {t.background ?? background} {t.classes}" role="alert" aria-live="polite" data-testid="toast">
106
106
  <div class="text-base">{@html t.message}</div>
@@ -3,7 +3,7 @@ declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
5
  /** Set the toast position.*/
6
- position?: string | undefined;
6
+ position?: "b" | "br" | "tr" | "t" | "l" | "r" | "tl" | "bl" | undefined;
7
7
  /** Maximum toasts that can show at once.*/
8
8
  max?: number | undefined;
9
9
  /** The duration of the fly in/out animation.*/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skeletonlabs/skeleton",
3
- "version": "v1.2.5",
3
+ "version": "v1.5.1",
4
4
  "description": "A SvelteKit component library.",
5
5
  "author": "endigo9740 <chris@skeletonlabs.dev>",
6
6
  "scripts": {
@@ -41,11 +41,13 @@
41
41
  "license": "MIT",
42
42
  "homepage": "https://skeleton.dev/",
43
43
  "devDependencies": {
44
+ "@faker-js/faker": "^7.6.0",
44
45
  "@floating-ui/dom": "^1.2.5",
45
46
  "@sveltejs/adapter-auto": "^2.0.0",
46
47
  "@sveltejs/kit": "^1.15.0",
47
48
  "@sveltejs/package": "^2.0.2",
48
49
  "@tailwindcss/forms": "^0.5.3",
50
+ "@tailwindcss/typography": "^0.5.9",
49
51
  "@testing-library/dom": "^9.2.0",
50
52
  "@testing-library/svelte": "^3.2.2",
51
53
  "@typescript-eslint/eslint-plugin": "^5.57.0",
@@ -79,6 +81,7 @@
79
81
  "type": "module",
80
82
  "types": "index.d.ts",
81
83
  "dependencies": {
84
+ "esm-env": "^1.0.0",
82
85
  "svelte": "^3.58.0"
83
86
  },
84
87
  "exports": {
@@ -1,18 +1,30 @@
1
- /* Stylesheet: all.css */
2
- /* Import AFTER your theme, but BEFORE your global stylesheet. */
1
+ /* Stylesheet: skeleton.css */
2
+
3
+ /*
4
+ - Will be replaced by `skeleton.css` in the next major release.
5
+ - All available stylesheets are imported
6
+ - Typography using on-by-default system
7
+ */
8
+
3
9
  /* NOTE: The order shown below is required */
10
+ /* Import AFTER your theme, but BEFORE your global stylesheet. */
4
11
 
5
12
  /* Tailwind Directives */
6
- @import 'tailwind.css';
13
+ @import 'partials/tailwind.css';
14
+
15
+ /* === OPTIONAL STYLESHEETS === */
16
+
17
+ /* Core Styles */
18
+ @import 'partials/core.css';
7
19
 
8
- /* Global Styles */
9
- @import 'core.css';
20
+ /* Typography Settings */
21
+ @import 'partials/typography.css';
22
+ @import 'partials/typography-prose.css';
10
23
 
11
- /* Typographical Settings */
12
- @import 'typography.css';
24
+ /* === REQUIRED STYLESHEETS === */
13
25
 
14
26
  /* Imports all Tailwind Elements */
15
- @import 'elements.css';
27
+ @import 'partials/elements.css';
16
28
 
17
29
  /* Imports all Variant Styles */
18
- @import 'variants.css';
30
+ @import 'partials/variants.css';
@@ -1,6 +1,16 @@
1
1
  /* Tailwind Elements: breadcrumbs.css */
2
2
 
3
3
  @layer components {
4
+ /* Hide Scrollbars */
5
+ /* Duplicated from core.css to support `skeleton-minimal.css` */
6
+ .hide-scrollbar::-webkit-scrollbar {
7
+ display: none;
8
+ }
9
+ .hide-scrollbar {
10
+ -ms-overflow-style: none; /* IE/Edge */
11
+ scrollbar-width: none; /* Firefox */
12
+ }
13
+
4
14
  .breadcrumb,
5
15
  .breadcrumb-nonresponsive {
6
16
  @apply flex items-center space-x-4 w-full hide-scrollbar overflow-x-auto;
@@ -0,0 +1,16 @@
1
+ /* Elements: codeblocks.css */
2
+
3
+ @layer components {
4
+ .codeblock pre {
5
+ counter-reset: line;
6
+ }
7
+
8
+ .codeblock code.lineNumbers > span.line {
9
+ counter-increment: line;
10
+ }
11
+
12
+ .codeblock code.lineNumbers > span.line::before {
13
+ content: counter(line) '';
14
+ @apply opacity-50;
15
+ }
16
+ }
@@ -25,6 +25,21 @@
25
25
  @apply dark:invert;
26
26
  }
27
27
 
28
+ /* Search Input "X" Cancel Button (Webkit) */
29
+ /* Source: https://stackoverflow.com/a/64267916 */
30
+ input[type='search']::-webkit-search-cancel-button {
31
+ -webkit-appearance: none;
32
+ background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath d='M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm121.6 313.1c4.7 4.7 4.7 12.3 0 17L338 377.6c-4.7 4.7-12.3 4.7-17 0L256 312l-65.1 65.6c-4.7 4.7-12.3 4.7-17 0L134.4 338c-4.7-4.7-4.7-12.3 0-17l65.6-65-65.6-65.1c-4.7-4.7-4.7-12.3 0-17l39.6-39.6c4.7-4.7 12.3-4.7 17 0l65 65.7 65.1-65.6c4.7-4.7 12.3-4.7 17 0l39.6 39.6c4.7 4.7 4.7 12.3 0 17L312 256l65.6 65.1z'/%3E%3C/svg%3E")
33
+ no-repeat 50% 50%;
34
+ @apply h-4 w-4 rounded-full bg-contain opacity-0 pointer-events-none;
35
+ }
36
+ input[type='search']:focus::-webkit-search-cancel-button {
37
+ @apply opacity-100 pointer-events-auto;
38
+ }
39
+ input[type='search']::-webkit-search-cancel-button {
40
+ @apply dark:invert;
41
+ }
42
+
28
43
  /* Progress Bar */
29
44
  progress {
30
45
  webkit-appearance: none;
@@ -18,13 +18,12 @@
18
18
  /* @apply bg-red-500; */
19
19
  @apply flex items-center space-x-4;
20
20
  /* Padding */
21
- @apply p-2;
21
+ /* @apply p-2; */
22
22
  /* Theme: Rounded */
23
23
  @apply rounded-token;
24
24
  /* Wrapping */
25
25
  @apply whitespace-normal break-words;
26
26
  }
27
-
28
27
  .list-dl div {
29
28
  /* @apply bg-blue-500; */
30
29
  @apply flex items-center space-x-4 whitespace-nowrap;
@@ -43,7 +42,7 @@
43
42
  /* Hover */
44
43
  @apply bg-primary-hover-token;
45
44
  /* Focus */
46
- @apply focus:!variant-filled-primary outline-none;
45
+ @apply focus:variant-soft-primary outline-none;
47
46
  /* Cursor */
48
47
  @apply cursor-pointer;
49
48
  /* Theme: Rounded */