@tanglemedia/svelte-starter-ui-shadcn 0.0.4 → 0.0.5

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.
@@ -42,11 +42,12 @@ export function createSvelteTable(options) {
42
42
  state: mergeObjects(state, options.state || {}),
43
43
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
44
44
  onStateChange: (updater) => {
45
+ var _a;
45
46
  if (updater instanceof Function)
46
47
  state = updater(state);
47
48
  else
48
49
  state = mergeObjects(state, updater);
49
- options.onStateChange?.(updater);
50
+ (_a = options.onStateChange) === null || _a === void 0 ? void 0 : _a.call(options, updater);
50
51
  },
51
52
  });
52
53
  });
@@ -15,8 +15,6 @@
15
15
  * ```
16
16
  */
17
17
  export class RenderComponentConfig {
18
- component;
19
- props;
20
18
  constructor(component, props = {}) {
21
19
  this.component = component;
22
20
  this.props = props;
@@ -38,8 +36,6 @@ export class RenderComponentConfig {
38
36
  * ```
39
37
  */
40
38
  export class RenderSnippetConfig {
41
- snippet;
42
- params;
43
39
  constructor(snippet, params) {
44
40
  this.snippet = snippet;
45
41
  this.params = params;
@@ -1,37 +1,48 @@
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _SidebarState_isMobile;
1
13
  import { IsMobile } from '../../../hooks/is-mobile.svelte.js';
2
14
  import { getContext, setContext } from 'svelte';
3
15
  import { SIDEBAR_KEYBOARD_SHORTCUT } from './constants.js';
4
16
  class SidebarState {
5
- props;
6
- open = $derived.by(() => this.props.open());
7
- openMobile = $state(false);
8
- setOpen;
9
- #isMobile;
10
- state = $derived.by(() => (this.open ? 'expanded' : 'collapsed'));
11
17
  constructor(props) {
18
+ this.open = $derived.by(() => this.props.open());
19
+ this.openMobile = $state(false);
20
+ _SidebarState_isMobile.set(this, void 0);
21
+ this.state = $derived.by(() => (this.open ? 'expanded' : 'collapsed'));
22
+ // Event handler to apply to the `<svelte:window>`
23
+ this.handleShortcutKeydown = (e) => {
24
+ if (e.key === SIDEBAR_KEYBOARD_SHORTCUT && (e.metaKey || e.ctrlKey)) {
25
+ e.preventDefault();
26
+ this.toggle();
27
+ }
28
+ };
29
+ this.setOpenMobile = (value) => {
30
+ this.openMobile = value;
31
+ };
32
+ this.toggle = () => {
33
+ return __classPrivateFieldGet(this, _SidebarState_isMobile, "f").current ? (this.openMobile = !this.openMobile) : this.setOpen(!this.open);
34
+ };
12
35
  this.setOpen = props.setOpen;
13
- this.#isMobile = new IsMobile();
36
+ __classPrivateFieldSet(this, _SidebarState_isMobile, new IsMobile(), "f");
14
37
  this.props = props;
15
38
  }
16
39
  // Convenience getter for checking if the sidebar is mobile
17
40
  // without this, we would need to use `sidebar.isMobile.current` everywhere
18
41
  get isMobile() {
19
- return this.#isMobile.current;
42
+ return __classPrivateFieldGet(this, _SidebarState_isMobile, "f").current;
20
43
  }
21
- // Event handler to apply to the `<svelte:window>`
22
- handleShortcutKeydown = (e) => {
23
- if (e.key === SIDEBAR_KEYBOARD_SHORTCUT && (e.metaKey || e.ctrlKey)) {
24
- e.preventDefault();
25
- this.toggle();
26
- }
27
- };
28
- setOpenMobile = (value) => {
29
- this.openMobile = value;
30
- };
31
- toggle = () => {
32
- return this.#isMobile.current ? (this.openMobile = !this.openMobile) : this.setOpen(!this.open);
33
- };
34
44
  }
45
+ _SidebarState_isMobile = new WeakMap();
35
46
  const SYMBOL_KEY = 'scn-sidebar';
36
47
  /**
37
48
  * Instantiates a new `SidebarState` instance and sets it in the context.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanglemedia/svelte-starter-ui-shadcn",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "main": "src/index.ts",
5
5
  "types": "src/index.ts",
6
6
  "description": "UI features and components for use in svelte websites",