@max-ts/svelte 1.10.2 → 1.10.4

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.
@@ -2,9 +2,6 @@ import type { Tooltip } from 'bits-ui';
2
2
  import type { Snippet } from 'svelte';
3
3
  export type TooltipProps<Payload = never> = Tooltip.RootProps & {
4
4
  content?: Snippet<[]> | string;
5
- child?: Snippet<[{
6
- props: Record<string, unknown>;
7
- }]>;
8
5
  arrow?: boolean;
9
6
  align?: Tooltip.ContentProps['align'];
10
7
  sideOffset?: number;
@@ -30,8 +30,12 @@ function RangeInput($$anchor, $$props) {
30
30
  ]);
31
31
  let timerId;
32
32
  const calculatedWidth = $.derived(() => calculateSize(width()));
33
- let innerMin = $.derived(() => formatNumber(value()?.[0] || min()));
34
- let innerMax = $.derived(() => formatNumber(value()?.[1] || max()));
33
+ let innerValue = $.state($.proxy([value()?.[0] || min(), value()?.[1] || max()]));
34
+ let innerMin = $.derived(() => formatNumber($.get(innerValue)[0]));
35
+ let innerMax = $.derived(() => formatNumber($.get(innerValue)[1]));
36
+ $.user_effect(() => {
37
+ $.set(innerValue, [value()?.[0] || min(), value()?.[1] || max()], true);
38
+ });
35
39
  const adaptiveStep = $.derived(() => {
36
40
  const range = max() - min();
37
41
  return Math.max(step(), Math.ceil(range / 1e3));
@@ -77,7 +81,7 @@ function RangeInput($$anchor, $$props) {
77
81
  return text;
78
82
  },
79
83
  color: "muted",
80
- variant: "caption",
84
+ variant: "body2",
81
85
  children: ($$anchor, $$slotProps) => {
82
86
  $.next();
83
87
  var text = $.text("от");
@@ -93,7 +97,7 @@ function RangeInput($$anchor, $$props) {
93
97
  return text;
94
98
  },
95
99
  color: "muted",
96
- variant: "caption",
100
+ variant: "body2",
97
101
  children: ($$anchor, $$slotProps) => {
98
102
  $.next();
99
103
  var text_1 = $.text("до");
@@ -109,7 +113,7 @@ function RangeInput($$anchor, $$props) {
109
113
  return text;
110
114
  },
111
115
  color: "muted",
112
- variant: "caption",
116
+ variant: "body2",
113
117
  children: ($$anchor, $$slotProps) => {
114
118
  $.next();
115
119
  var text_2 = $.text();
@@ -142,10 +146,10 @@ function RangeInput($$anchor, $$props) {
142
146
  onValueCommit: handleSliderCommit,
143
147
  onValueChange: handleSliderChange,
144
148
  get value() {
145
- return value();
149
+ return $.get(innerValue);
146
150
  },
147
151
  set value($$value) {
148
- value($$value);
152
+ $.set(innerValue, $$value, true);
149
153
  }
150
154
  });
151
155
  $.reset(div);
@@ -8,10 +8,7 @@ import { Tooltip } from "bits-ui";
8
8
  var root_2 = $.from_html(`<!> <!>`, 1);
9
9
  function Tooltip$1($$anchor, $$props) {
10
10
  $.push($$props, true);
11
- let open = $.prop($$props, "open", 15, false), alignOffset = $.prop($$props, "alignOffset", 3, 0), sideOffset = $.prop($$props, "sideOffset", 3, 4), side = $.prop($$props, "side", 3, "top");
12
- $.prop($$props, "triggerId", 3, null);
13
- $.prop($$props, "payload", 3, null);
14
- let restProps = $.rest_props($$props, [
11
+ let open = $.prop($$props, "open", 15, false), alignOffset = $.prop($$props, "alignOffset", 3, 0), sideOffset = $.prop($$props, "sideOffset", 3, 4), side = $.prop($$props, "side", 3, "top"), triggerId = $.prop($$props, "triggerId", 3, null), payload = $.prop($$props, "payload", 3, null), restProps = $.rest_props($$props, [
15
12
  "$$slots",
16
13
  "$$events",
17
14
  "$$legacy",
@@ -25,8 +22,7 @@ function Tooltip$1($$anchor, $$props) {
25
22
  "arrow",
26
23
  "arrowClass",
27
24
  "triggerId",
28
- "payload",
29
- "child"
25
+ "payload"
30
26
  ]);
31
27
  Provider($$anchor, {
32
28
  children: ($$anchor, $$slotProps) => {
@@ -43,9 +39,19 @@ function Tooltip$1($$anchor, $$props) {
43
39
  children: ($$anchor, $$slotProps) => {
44
40
  var fragment_2 = root_2();
45
41
  var node_1 = $.first_child(fragment_2);
46
- Trigger(node_1, { get child() {
47
- return $$props.child;
48
- } });
42
+ Trigger(node_1, {
43
+ children: ($$anchor, $$slotProps) => {
44
+ var fragment_3 = $.comment();
45
+ var node_2 = $.first_child(fragment_3);
46
+ $.snippet(node_2, () => $$props.children ?? $.noop, () => ({
47
+ open: open(),
48
+ triggerId: triggerId(),
49
+ payload: payload()
50
+ }));
51
+ $.append($$anchor, fragment_3);
52
+ },
53
+ $$slots: { default: true }
54
+ });
49
55
  Content($.sibling(node_1, 2), {
50
56
  get class() {
51
57
  return $$props.class;
@@ -67,24 +73,24 @@ function Tooltip$1($$anchor, $$props) {
67
73
  },
68
74
  hideWhenDetached: true,
69
75
  children: ($$anchor, $$slotProps) => {
70
- var fragment_3 = $.comment();
71
- var node_3 = $.first_child(fragment_3);
76
+ var fragment_4 = $.comment();
77
+ var node_4 = $.first_child(fragment_4);
72
78
  var consequent = ($$anchor) => {
73
79
  var text = $.text();
74
80
  $.template_effect(() => $.set_text(text, $$props.content));
75
81
  $.append($$anchor, text);
76
82
  };
77
83
  var alternate = ($$anchor) => {
78
- var fragment_5 = $.comment();
79
- var node_4 = $.first_child(fragment_5);
80
- $.snippet(node_4, () => $$props.content ?? $.noop);
81
- $.append($$anchor, fragment_5);
84
+ var fragment_6 = $.comment();
85
+ var node_5 = $.first_child(fragment_6);
86
+ $.snippet(node_5, () => $$props.content ?? $.noop);
87
+ $.append($$anchor, fragment_6);
82
88
  };
83
- $.if(node_3, ($$render) => {
89
+ $.if(node_4, ($$render) => {
84
90
  if (typeof $$props.content === "string") $$render(consequent);
85
91
  else $$render(alternate, -1);
86
92
  });
87
- $.append($$anchor, fragment_3);
93
+ $.append($$anchor, fragment_4);
88
94
  },
89
95
  $$slots: { default: true }
90
96
  });
@@ -4,9 +4,6 @@ import { Snippet } from "svelte";
4
4
  //#region src/components/Tooltip/types.d.ts
5
5
  type TooltipProps<Payload = never> = Tooltip.RootProps & {
6
6
  content?: Snippet<[]> | string;
7
- child?: Snippet<[{
8
- props: Record<string, unknown>;
9
- }]>;
10
7
  arrow?: boolean;
11
8
  align?: Tooltip.ContentProps['align'];
12
9
  sideOffset?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@max-ts/svelte",
3
- "version": "1.10.2",
3
+ "version": "1.10.4",
4
4
  "type": "module",
5
5
  "description": "Svelte component library.",
6
6
  "author": "Tsepelev Maksim",