@chocbite/ts-lib-ui 0.0.0-stage → 1.0.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 (57) hide show
  1. package/README.md +48 -2
  2. package/base/index.d.mts +3 -0
  3. package/base/index.mjs +521 -0
  4. package/base/index.mjs.map +1 -0
  5. package/canvas/index.d.mts +74 -0
  6. package/canvas/index.mjs +619 -0
  7. package/canvas/index.mjs.map +1 -0
  8. package/context-menu/index.d.mts +3 -0
  9. package/context-menu/index.mjs +2 -0
  10. package/context-menu-3OazryD0.mjs +527 -0
  11. package/context-menu-3OazryD0.mjs.map +1 -0
  12. package/document/index.d.mts +27 -0
  13. package/document/index.mjs +50 -0
  14. package/document/index.mjs.map +1 -0
  15. package/dom/index.d.mts +3 -0
  16. package/dom/index.mjs +8 -0
  17. package/dom/index.mjs.map +1 -0
  18. package/form/index.d.mts +747 -0
  19. package/form/index.mjs +2694 -0
  20. package/form/index.mjs.map +1 -0
  21. package/icons/index.d.mts +4109 -0
  22. package/icons/index.mjs +2 -0
  23. package/icons/mixins.scss +12 -0
  24. package/icons-CY4BLQ2F.mjs +4123 -0
  25. package/index-BND79jZp.d.mts +212 -0
  26. package/index-BcidwqIy.d.mts +167 -0
  27. package/index-CB3-qP6l.d.mts +120 -0
  28. package/index-CugtUzv_.d.mts +155 -0
  29. package/keyboard/index.d.mts +85 -0
  30. package/keyboard/index.mjs +1499 -0
  31. package/keyboard/index.mjs.map +1 -0
  32. package/list/index.d.mts +3 -0
  33. package/list/index.mjs +2 -0
  34. package/list-BcNSxtNm.mjs +617 -0
  35. package/list-BcNSxtNm.mjs.map +1 -0
  36. package/package.json +95 -4
  37. package/selection/index.d.mts +16 -0
  38. package/selection/index.mjs +96 -0
  39. package/selection/index.mjs.map +1 -0
  40. package/settings/index.d.mts +43 -0
  41. package/settings/index.mjs +110 -0
  42. package/settings/index.mjs.map +1 -0
  43. package/spinner/index.d.mts +10 -0
  44. package/spinner/index.mjs +39 -0
  45. package/spinner/index.mjs.map +1 -0
  46. package/style.css +2994 -0
  47. package/svg/index.d.mts +3 -0
  48. package/svg/index.mjs +2 -0
  49. package/svg-golJPaR4.mjs +358 -0
  50. package/svg-golJPaR4.mjs.map +1 -0
  51. package/theme/index.d.mts +179 -0
  52. package/theme/index.mjs +2 -0
  53. package/theme/mixins.scss +39 -0
  54. package/theme-DhIVwHQw.mjs +338 -0
  55. package/theme-DhIVwHQw.mjs.map +1 -0
  56. package/viewport/index.d.mts +1 -0
  57. package/viewport/index.mjs +2 -0
@@ -0,0 +1,3 @@
1
+ import '../style.css';
2
+ import { n as svg, r as SVGAnchorPoint, t as SVGFunc } from "../index-BcidwqIy.mjs";
3
+ export { SVGAnchorPoint, SVGFunc, svg };
package/svg/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import "../style.css";
2
+ export { n as SVGAnchorPoint, t as svg } from "../svg-golJPaR4.mjs";
@@ -0,0 +1,358 @@
1
+ import "./style.css";
2
+ import { degrees_to_radians } from "@chocbite/ts-lib/math";
3
+ // src/svg/attributes.ts
4
+ var SVGAttributes = class {
5
+ constructor(elem) {
6
+ this.#elem = elem;
7
+ }
8
+ #elem;
9
+ /**Returns the svg element */
10
+ get elem() {
11
+ this.#apply_transforms();
12
+ return this.#elem;
13
+ }
14
+ /** Sets the stroke color of the SVG element */
15
+ stroke(stroke) {
16
+ this.#elem.setAttribute("stroke", stroke);
17
+ return this;
18
+ }
19
+ /** Sets the stroke color of the SVG element */
20
+ s(stroke) {
21
+ this.#elem.setAttribute("stroke", stroke);
22
+ return this;
23
+ }
24
+ /** Sets the fill color of the SVG element */
25
+ fill(fill) {
26
+ this.#elem.setAttribute("fill", fill);
27
+ return this;
28
+ }
29
+ /** Sets the fill color of the SVG element */
30
+ f(fill) {
31
+ this.#elem.setAttribute("fill", fill);
32
+ return this;
33
+ }
34
+ /** Sets the stroke width of the SVG element */
35
+ stroke_width(width) {
36
+ this.#elem.setAttribute("stroke-width", String(width));
37
+ return this;
38
+ }
39
+ /** Sets the stroke width of the SVG element */
40
+ sw(width) {
41
+ this.#elem.setAttribute("stroke-width", String(width));
42
+ return this;
43
+ }
44
+ /** Adds one or more class names to the SVG element */
45
+ class_list(...class_name) {
46
+ this.#elem.classList.add(...class_name);
47
+ return this;
48
+ }
49
+ /** Adds one or more class names to the SVG element */
50
+ cl(...class_name) {
51
+ this.#elem.classList.add(...class_name);
52
+ return this;
53
+ }
54
+ /** Sets an arbitrary attribute on the SVG element */
55
+ attribute(name, value) {
56
+ this.#elem.setAttribute(name, value);
57
+ return this;
58
+ }
59
+ /** Sets an arbitrary attribute on the SVG element */
60
+ a(name, value) {
61
+ this.#elem.setAttribute(name, value);
62
+ return this;
63
+ }
64
+ #transforms = [];
65
+ #apply_transforms() {
66
+ if (this.#transforms.length > 0) this.#elem.setAttribute("transform", this.#transforms.join(" "));
67
+ }
68
+ /** Applies a translation transform to the SVG element */
69
+ translate(x, y) {
70
+ this.#transforms.push(`translate(${x} ${y})`);
71
+ return this;
72
+ }
73
+ /** Applies a rotation transform to the SVG element */
74
+ rotate(angle, cx, cy) {
75
+ if (cx !== void 0 && cy !== void 0) this.#transforms.push(`rotate(${angle} ${cx} ${cy})`);
76
+ else this.#transforms.push(`rotate(${angle})`);
77
+ return this;
78
+ }
79
+ /** Applies a scaling transform to the SVG element */
80
+ scale(sx, sy) {
81
+ if (sy !== void 0) this.#transforms.push(`scale(${sx} ${sy})`);
82
+ else this.#transforms.push(`scale(${sx})`);
83
+ return this;
84
+ }
85
+ /** Applies a skewX transform to the SVG element */
86
+ skewX(angle) {
87
+ this.#transforms.push(`skewX(${angle})`);
88
+ return this;
89
+ }
90
+ /** Applies a skewY transform to the SVG element */
91
+ skewY(angle) {
92
+ this.#transforms.push(`skewY(${angle})`);
93
+ return this;
94
+ }
95
+ /** Applies a custom transform to the SVG element */
96
+ transform(transform) {
97
+ this.#transforms.push(transform);
98
+ return this;
99
+ }
100
+ };
101
+ // src/svg/shared.ts
102
+ const NAME_SPACE = "http://www.w3.org/2000/svg";
103
+ // src/svg/primitives/shared.ts
104
+ function create_svg_element(name) {
105
+ return new SVGAttributes(document.createElementNS(NAME_SPACE, name));
106
+ }
107
+ // src/svg/primitives/ellipse.ts
108
+ /**This creates a svg ellipse
109
+ * @param center_x x coordinate of center
110
+ * @param center_y y coordinate of center
111
+ * @param radius_x x radius of circle
112
+ * @param radius_y y radius of circle*/
113
+ function ellipse(center_x, center_y, radius_x, radius_y) {
114
+ return create_svg_element("ellipse").a("cx", String(center_x)).a("cy", String(center_y)).a("rx", String(radius_x)).a("ry", String(radius_y));
115
+ }
116
+ /**This draws parts of a circle/ellipse, the circle direction is reversed
117
+ * @param center_x the center point on the x axis
118
+ * @param center_y the center point on the y axis
119
+ * @param radius_x radius in x axis
120
+ * @param radius_y radius in y axis
121
+ * @param start_angle start angle in radians
122
+ * @param end_angle end anglein radians*/
123
+ function ellipse_arc(center_x, center_y, radius_x, radius_y, start_angle, end_angle) {
124
+ const start_radian = degrees_to_radians(start_angle);
125
+ end_angle = degrees_to_radians(end_angle - start_angle);
126
+ const s_x = radius_x * Math.cos(start_radian) + center_x;
127
+ const s_y = radius_y * Math.sin(start_radian) + center_y;
128
+ const e_x = radius_x * Math.cos(start_radian + end_angle) + center_x;
129
+ const e_y = radius_y * Math.sin(start_radian + end_angle) + center_y;
130
+ const f_a = end_angle > Math.PI ? 1 : 0;
131
+ const f_s = end_angle > 0 ? 1 : 0;
132
+ return create_svg_element("path").a("d", `M ${s_x} ${s_y} A ${radius_x} ${radius_y} 0 ${f_a} ${f_s} ${e_x} ${e_y}`);
133
+ }
134
+ // src/svg/primitives/circle.ts
135
+ /**This creates a svg circle
136
+ * @param center_x x coordinate of center
137
+ * @param center_y y coordinate of center
138
+ * @param radius radius of circle*/
139
+ function circle(center_x, center_y, radius) {
140
+ const circle = create_svg_element("circle");
141
+ circle.a("cx", String(center_x));
142
+ circle.a("cy", String(center_y));
143
+ circle.a("r", String(radius));
144
+ return circle;
145
+ }
146
+ /**This draws parts of a circle/ellipse, the circle direction is reversed
147
+ * @param center_x the center point on the x axis
148
+ * @param center_y the center point on the y axis
149
+ * @param radius radius in x axis
150
+ * @param start_angle start angle in radians
151
+ * @param end_angle end anglein radians*/
152
+ function circle_arc(center_x, center_y, radius, start_angle, end_angle) {
153
+ return ellipse_arc(center_x, center_y, radius, radius, start_angle, end_angle);
154
+ }
155
+ // src/svg/primitives/group.ts
156
+ /**This draws a triangle*/
157
+ function group() {
158
+ return create_svg_element("g");
159
+ }
160
+ // src/svg/primitives/line.ts
161
+ /**This creates a line element
162
+ * @param start_x start point on x axis
163
+ * @param start_y start point on y axis
164
+ * @param end_x end point on x axis
165
+ * @param end_y end point on y axis*/
166
+ function line(start_x, start_y, end_x, end_y) {
167
+ return create_svg_element("line").a("x1", String(start_x)).a("y1", String(start_y)).a("x2", String(end_x)).a("y2", String(end_y));
168
+ }
169
+ // src/svg/primitives/path.ts
170
+ /**This creates a path element*/
171
+ function path(path) {
172
+ return create_svg_element("path").a("d", path);
173
+ }
174
+ // src/svg/primitives/rectangle.ts
175
+ /**This creates a rectangle with teh center as origin
176
+ * @param center_x x coordinate of center
177
+ * @param center_y y coordinate of center
178
+ * @param width width
179
+ * @param height height
180
+ * @param corner_radius radius of corner*/
181
+ function rectangle_from_center(center_x, center_y, width, height, corner_radius) {
182
+ return create_svg_element("rect").a("x", String(center_x - width / 2)).a("y", String(center_y - height / 2)).a("width", String(width)).a("height", String(height)).a("rx", String(corner_radius));
183
+ }
184
+ /**This creates a rectangle with teh center as origin
185
+ * @param start_x x coordinate of center
186
+ * @param start_y y coordinate of center
187
+ * @param width width
188
+ * @param height height
189
+ * @param corner_radius radius of corner*/
190
+ function rectangle_from_corner(start_x, start_y, width, height, corner_radius) {
191
+ return create_svg_element("rect").a("x", String(start_x)).a("y", String(start_y)).a("width", String(width)).a("height", String(height)).a("rx", String(corner_radius));
192
+ }
193
+ // src/svg/primitives/svg.ts
194
+ /** This returns an empty svg element
195
+ * @param width width of svg
196
+ * @param height height of svg
197
+ * @param viewbox viewbox of svg*/
198
+ function svg$1(width, height, viewbox = `0 0 ${width} ${height}`) {
199
+ return create_svg_element("svg").a("width", String(width)).a("height", String(height)).a("viewBox", String(viewbox));
200
+ }
201
+ // src/svg/util/anchorPoint.ts
202
+ const SVGAnchorPoint = {
203
+ bottomLeft: 0,
204
+ middleLeft: 1,
205
+ topLeft: 2,
206
+ topCenter: 3,
207
+ topRight: 4,
208
+ middleRight: 5,
209
+ bottomRight: 6,
210
+ bottomCenter: 7,
211
+ middleCenter: 8
212
+ };
213
+ // src/svg/primitives/text.ts
214
+ /**Creates a text nodes for an svg
215
+ * @param x x coordinate of text
216
+ * @param y y coordinate of text
217
+ * @param text text
218
+ * @param size size of text in px
219
+ * @param anchor anchor point of text*/
220
+ function text(x, y, text, size, anchor) {
221
+ const text_elem = create_svg_element("text").a("x", String(x)).a("y", String(y)).a("font-size", String(size));
222
+ text_elem.elem.innerHTML = text;
223
+ switch (anchor) {
224
+ case SVGAnchorPoint.bottomLeft:
225
+ case SVGAnchorPoint.middleLeft:
226
+ case SVGAnchorPoint.topLeft:
227
+ text_elem.a("text-anchor", "start");
228
+ break;
229
+ case SVGAnchorPoint.topCenter:
230
+ case SVGAnchorPoint.bottomCenter:
231
+ case SVGAnchorPoint.middleCenter:
232
+ text_elem.a("text-anchor", "middle");
233
+ break;
234
+ case SVGAnchorPoint.topRight:
235
+ case SVGAnchorPoint.middleRight:
236
+ case SVGAnchorPoint.bottomRight: text_elem.a("text-anchor", "end");
237
+ }
238
+ switch (anchor) {
239
+ case SVGAnchorPoint.bottomLeft:
240
+ case SVGAnchorPoint.bottomRight:
241
+ case SVGAnchorPoint.bottomCenter:
242
+ text_elem.a("dominant-baseline", "auto");
243
+ break;
244
+ case SVGAnchorPoint.middleLeft:
245
+ case SVGAnchorPoint.middleRight:
246
+ case SVGAnchorPoint.middleCenter:
247
+ text_elem.a("dominant-baseline", "central");
248
+ break;
249
+ case SVGAnchorPoint.topLeft:
250
+ case SVGAnchorPoint.topCenter:
251
+ case SVGAnchorPoint.topRight: text_elem.a("dominant-baseline", "hanging");
252
+ }
253
+ return text_elem;
254
+ }
255
+ /**Creates a text nodes for an svg
256
+ * @param x x coordinate of text
257
+ * @param y y coordinate of text
258
+ * @param width width of text
259
+ * @param height height of text
260
+ * @param text text
261
+ * @param size size of text in px
262
+ * @param anchor anchor point of */
263
+ function multi_line_text(x, y, width, height, text, size, anchor) {
264
+ const text_element = create_svg_element("foreignObject");
265
+ const text_div = text_element.elem.appendChild(document.createElement("div"));
266
+ text_element.a("width", String(width));
267
+ text_element.a("height", String(height));
268
+ text_element.a("x", String(x));
269
+ text_element.a("y", String(y));
270
+ text_div.style.fontSize = size + "px";
271
+ text_div.style.width = "100%";
272
+ text_div.style.height = "100%";
273
+ text_div.style.display = "flex";
274
+ text_div.innerHTML = text;
275
+ switch (anchor) {
276
+ case SVGAnchorPoint.bottomLeft:
277
+ case SVGAnchorPoint.middleLeft:
278
+ case SVGAnchorPoint.topLeft:
279
+ text_div.style.textAlign = "start";
280
+ text_div.style.justifyContent = "flex-start";
281
+ break;
282
+ case SVGAnchorPoint.topCenter:
283
+ case SVGAnchorPoint.bottomCenter:
284
+ case SVGAnchorPoint.middleCenter:
285
+ text_div.style.textAlign = "center";
286
+ text_div.style.justifyContent = "center";
287
+ break;
288
+ case SVGAnchorPoint.topRight:
289
+ case SVGAnchorPoint.middleRight:
290
+ case SVGAnchorPoint.bottomRight:
291
+ text_div.style.textAlign = "end";
292
+ text_div.style.justifyContent = "flex-end";
293
+ }
294
+ switch (anchor) {
295
+ case SVGAnchorPoint.bottomLeft:
296
+ case SVGAnchorPoint.bottomRight:
297
+ case SVGAnchorPoint.bottomCenter:
298
+ text_div.style.alignItems = "flex-end";
299
+ break;
300
+ case SVGAnchorPoint.middleLeft:
301
+ case SVGAnchorPoint.middleRight:
302
+ case SVGAnchorPoint.middleCenter:
303
+ text_div.style.alignItems = "center";
304
+ break;
305
+ case SVGAnchorPoint.topLeft:
306
+ case SVGAnchorPoint.topCenter:
307
+ case SVGAnchorPoint.topRight: text_div.style.alignItems = "flex-start";
308
+ }
309
+ return text_element;
310
+ }
311
+ // src/svg/primitives/triangle.ts
312
+ /**This draws a triangle
313
+ * @param center_x x coordinate of center
314
+ * @param center_y y coordinate of center
315
+ * @param width width
316
+ * @param height height*/
317
+ function isosceles_triangle(center_x, center_y, width, height) {
318
+ const half_w = width / 2;
319
+ const half_h = height / 2;
320
+ return create_svg_element("path").a("d", "M" + (center_x - half_w) + "," + (center_y + half_h) + " " + (center_x + half_w) + "," + (center_y + half_h) + " " + center_x + "," + (center_y - half_h) + "Z");
321
+ }
322
+ // src/svg/util/angleToAnchorPoint.ts
323
+ /**Converts an angle to an anchor point
324
+ * @param angle angle in radians*/
325
+ const angle_to_anchor_point = (angle) => {
326
+ const sec = angle >= 0 ? angle % 6.283185307179586 : -(angle % 6.283185307179586);
327
+ if (sec > 5.93411945678072) return SVGAnchorPoint.middleRight;
328
+ else if (sec > 4.974188368183839) return SVGAnchorPoint.topRight;
329
+ else if (sec > 4.45058959258554) return SVGAnchorPoint.topCenter;
330
+ else if (sec > 3.490658503988659) return SVGAnchorPoint.topLeft;
331
+ else if (sec > 2.792526803190927) return SVGAnchorPoint.middleLeft;
332
+ else if (sec > 1.832595714594046) return SVGAnchorPoint.bottomLeft;
333
+ else if (sec > 1.308996938995747) return SVGAnchorPoint.bottomCenter;
334
+ else if (sec > .3490658503988659) return SVGAnchorPoint.bottomRight;
335
+ else return SVGAnchorPoint.middleRight;
336
+ };
337
+ // src/svg/index.ts
338
+ const svg = {
339
+ create: create_svg_element,
340
+ attr: (elem) => new SVGAttributes(elem),
341
+ circle,
342
+ circle_arc,
343
+ ellipse,
344
+ ellipse_arc,
345
+ group,
346
+ line,
347
+ path,
348
+ rectangle_from_center,
349
+ rectangle_from_corner,
350
+ svg: svg$1,
351
+ text,
352
+ multi_line_text,
353
+ isosceles_triangle,
354
+ angle_to_anchor_point
355
+ };
356
+ export { SVGAnchorPoint as n, svg as t };
357
+
358
+ //# sourceMappingURL=svg-golJPaR4.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg-golJPaR4.mjs","names":["svg","svgsvg"],"sources":["../src/svg/attributes.ts","../src/svg/shared.ts","../src/svg/primitives/shared.ts","../src/svg/primitives/ellipse.ts","../src/svg/primitives/circle.ts","../src/svg/primitives/group.ts","../src/svg/primitives/line.ts","../src/svg/primitives/path.ts","../src/svg/primitives/rectangle.ts","../src/svg/primitives/svg.ts","../src/svg/util/anchorPoint.ts","../src/svg/primitives/text.ts","../src/svg/primitives/triangle.ts","../src/svg/util/angleToAnchorPoint.ts","../src/svg/index.ts"],"sourcesContent":["export class SVGAttributes<T extends SVGElement> {\n constructor(elem: T) {\n this.#elem = elem;\n }\n #elem: T;\n /**Returns the svg element */\n get elem(): T {\n this.#apply_transforms();\n return this.#elem;\n }\n\n /** Sets the stroke color of the SVG element */\n stroke(stroke: string): this {\n this.#elem.setAttribute(\"stroke\", stroke);\n return this;\n }\n /** Sets the stroke color of the SVG element */\n s(stroke: string): this {\n this.#elem.setAttribute(\"stroke\", stroke);\n return this;\n }\n\n /** Sets the fill color of the SVG element */\n fill(fill: string): this {\n this.#elem.setAttribute(\"fill\", fill);\n return this;\n }\n /** Sets the fill color of the SVG element */\n f(fill: string): this {\n this.#elem.setAttribute(\"fill\", fill);\n return this;\n }\n\n /** Sets the stroke width of the SVG element */\n stroke_width(width: number): this {\n this.#elem.setAttribute(\"stroke-width\", String(width));\n return this;\n }\n /** Sets the stroke width of the SVG element */\n sw(width: number): this {\n this.#elem.setAttribute(\"stroke-width\", String(width));\n return this;\n }\n\n /** Adds one or more class names to the SVG element */\n class_list(...class_name: string[]): this {\n this.#elem.classList.add(...class_name);\n return this;\n }\n /** Adds one or more class names to the SVG element */\n cl(...class_name: string[]): this {\n this.#elem.classList.add(...class_name);\n return this;\n }\n\n /** Sets an arbitrary attribute on the SVG element */\n attribute(name: string, value: string): this {\n this.#elem.setAttribute(name, value);\n return this;\n }\n /** Sets an arbitrary attribute on the SVG element */\n a(name: string, value: string): this {\n this.#elem.setAttribute(name, value);\n return this;\n }\n\n #transforms: string[] = [];\n #apply_transforms(): void {\n if (this.#transforms.length > 0)\n this.#elem.setAttribute(\"transform\", this.#transforms.join(\" \"));\n }\n\n /** Applies a translation transform to the SVG element */\n translate(x: number, y: number): this {\n this.#transforms.push(`translate(${x} ${y})`);\n return this;\n }\n\n /** Applies a rotation transform to the SVG element */\n rotate(angle: number, cx?: number, cy?: number): this {\n if (cx !== undefined && cy !== undefined)\n this.#transforms.push(`rotate(${angle} ${cx} ${cy})`);\n else this.#transforms.push(`rotate(${angle})`);\n return this;\n }\n\n /** Applies a scaling transform to the SVG element */\n scale(sx: number, sy?: number): this {\n if (sy !== undefined) this.#transforms.push(`scale(${sx} ${sy})`);\n else this.#transforms.push(`scale(${sx})`);\n return this;\n }\n\n /** Applies a skewX transform to the SVG element */\n skewX(angle: number): this {\n this.#transforms.push(`skewX(${angle})`);\n return this;\n }\n\n /** Applies a skewY transform to the SVG element */\n skewY(angle: number): this {\n this.#transforms.push(`skewY(${angle})`);\n return this;\n }\n\n /** Applies a custom transform to the SVG element */\n transform(transform: string): this {\n this.#transforms.push(transform);\n return this;\n }\n}\n","export const NAME_SPACE = \"http://www.w3.org/2000/svg\";\n","import { SVGAttributes } from \"../attributes\";\nimport { NAME_SPACE } from \"../shared\";\n\ntype SVGElements = {\n ellipse: SVGEllipseElement;\n circle: SVGCircleElement;\n path: SVGPathElement;\n line: SVGLineElement;\n rect: SVGRectElement;\n text: SVGTextElement;\n g: SVGGElement;\n svg: SVGSVGElement;\n foreignObject: SVGForeignObjectElement;\n};\n\nexport function create_svg_element<K extends keyof SVGElements>(\n name: K,\n): SVGAttributes<SVGElements[K]> {\n return new SVGAttributes(document.createElementNS(NAME_SPACE, name));\n}\n","import { degrees_to_radians } from \"@chocbite/ts-lib/math\";\nimport { SVGAttributes } from \"../attributes\";\nimport { create_svg_element } from \"./shared\";\n\n/**This creates a svg ellipse\n * @param center_x x coordinate of center\n * @param center_y y coordinate of center\n * @param radius_x x radius of circle\n * @param radius_y y radius of circle*/\nexport function ellipse(\n center_x: number,\n center_y: number,\n radius_x: number,\n radius_y: number,\n): SVGAttributes<SVGEllipseElement> {\n return create_svg_element(\"ellipse\")\n .a(\"cx\", String(center_x))\n .a(\"cy\", String(center_y))\n .a(\"rx\", String(radius_x))\n .a(\"ry\", String(radius_y));\n}\n\n/**This draws parts of a circle/ellipse, the circle direction is reversed\n * @param center_x the center point on the x axis\n * @param center_y the center point on the y axis\n * @param radius_x radius in x axis\n * @param radius_y radius in y axis\n * @param start_angle start angle in radians\n * @param end_angle end anglein radians*/\nexport function ellipse_arc(\n center_x: number,\n center_y: number,\n radius_x: number,\n radius_y: number,\n start_angle: number,\n end_angle: number,\n): SVGAttributes<SVGPathElement> {\n const start_radian = degrees_to_radians(start_angle);\n end_angle = degrees_to_radians(end_angle - start_angle);\n const s_x = radius_x * Math.cos(start_radian) + center_x;\n const s_y = radius_y * Math.sin(start_radian) + center_y;\n const e_x = radius_x * Math.cos(start_radian + end_angle) + center_x;\n const e_y = radius_y * Math.sin(start_radian + end_angle) + center_y;\n const f_a = end_angle > Math.PI ? 1 : 0;\n const f_s = end_angle > 0 ? 1 : 0;\n return create_svg_element(\"path\").a(\n \"d\",\n `M ${s_x} ${s_y} A ${radius_x} ${radius_y} 0 ${f_a} ${f_s} ${e_x} ${e_y}`,\n );\n}\n","import { SVGAttributes } from \"../attributes\";\nimport { ellipse_arc } from \"./ellipse\";\nimport { create_svg_element } from \"./shared\";\n\n/**This creates a svg circle\n * @param center_x x coordinate of center\n * @param center_y y coordinate of center\n * @param radius radius of circle*/\nexport function circle(\n center_x: number,\n center_y: number,\n radius: number,\n): SVGAttributes<SVGCircleElement> {\n const circle = create_svg_element(\"circle\");\n circle.a(\"cx\", String(center_x));\n circle.a(\"cy\", String(center_y));\n circle.a(\"r\", String(radius));\n return circle;\n}\n\n/**This draws parts of a circle/ellipse, the circle direction is reversed\n * @param center_x the center point on the x axis\n * @param center_y the center point on the y axis\n * @param radius radius in x axis\n * @param start_angle start angle in radians\n * @param end_angle end anglein radians*/\nexport function circle_arc(\n center_x: number,\n center_y: number,\n radius: number,\n start_angle: number,\n end_angle: number,\n): SVGAttributes<SVGPathElement> {\n return ellipse_arc(\n center_x,\n center_y,\n radius,\n radius,\n start_angle,\n end_angle,\n );\n}\n","import { SVGAttributes } from \"../attributes\";\nimport { create_svg_element } from \"./shared\";\n\n/**This draws a triangle*/\nexport function group(): SVGAttributes<SVGGElement> {\n return create_svg_element(\"g\");\n}\n","import { SVGAttributes } from \"../attributes\";\nimport { create_svg_element } from \"./shared\";\n\n/**This creates a line element\n * @param start_x start point on x axis\n * @param start_y start point on y axis\n * @param end_x end point on x axis\n * @param end_y end point on y axis*/\nexport function line(\n start_x: number,\n start_y: number,\n end_x: number,\n end_y: number,\n): SVGAttributes<SVGLineElement> {\n return create_svg_element(\"line\")\n .a(\"x1\", String(start_x))\n .a(\"y1\", String(start_y))\n .a(\"x2\", String(end_x))\n .a(\"y2\", String(end_y));\n}\n","import { SVGAttributes } from \"../attributes\";\nimport { create_svg_element } from \"./shared\";\n\n/**This creates a path element*/\nexport function path(path: string): SVGAttributes<SVGPathElement> {\n return create_svg_element(\"path\").a(\"d\", path);\n}\n\n/**This creates a line with a path element\n * @param start_x start point on x axis\n * @param start_y start point on y axis\n * @param end_x end point on x axis\n * @param end_y end point on y axis*/\nexport function path_line(\n start_x: number,\n start_y: number,\n end_x: number,\n end_y: number,\n): SVGAttributes<SVGPathElement> {\n return create_svg_element(\"path\").a(\n \"d\",\n `M ${start_x} ${start_y} L ${end_x} ${end_y}`,\n );\n}\n","import { SVGAttributes } from \"../attributes\";\nimport { create_svg_element } from \"./shared\";\n\n/**This creates a rectangle with teh center as origin\n * @param center_x x coordinate of center\n * @param center_y y coordinate of center\n * @param width width\n * @param height height\n * @param corner_radius radius of corner*/\nexport function rectangle_from_center(\n center_x: number,\n center_y: number,\n width: number,\n height: number,\n corner_radius: number,\n): SVGAttributes<SVGRectElement> {\n return create_svg_element(\"rect\")\n .a(\"x\", String(center_x - width / 2))\n .a(\"y\", String(center_y - height / 2))\n .a(\"width\", String(width))\n .a(\"height\", String(height))\n .a(\"rx\", String(corner_radius));\n}\n\n/**This creates a rectangle with teh center as origin\n * @param start_x x coordinate of center\n * @param start_y y coordinate of center\n * @param width width\n * @param height height\n * @param corner_radius radius of corner*/\nexport function rectangle_from_corner(\n start_x: number,\n start_y: number,\n width: number,\n height: number,\n corner_radius: number,\n): SVGAttributes<SVGRectElement> {\n return create_svg_element(\"rect\")\n .a(\"x\", String(start_x))\n .a(\"y\", String(start_y))\n .a(\"width\", String(width))\n .a(\"height\", String(height))\n .a(\"rx\", String(corner_radius));\n}\n","import { SVGAttributes } from \"../attributes\";\nimport { create_svg_element } from \"./shared\";\n\n/** This returns an empty svg element\n * @param width width of svg\n * @param height height of svg\n * @param viewbox viewbox of svg*/\nexport function svg(\n width: number,\n height: number,\n viewbox: string = `0 0 ${width} ${height}`,\n): SVGAttributes<SVGSVGElement> {\n return create_svg_element(\"svg\")\n .a(\"width\", String(width))\n .a(\"height\", String(height))\n .a(\"viewBox\", String(viewbox));\n}\n","//Enum describing the diffrent possible anchor points\nexport const SVGAnchorPoint = {\n bottomLeft: 0,\n middleLeft: 1,\n topLeft: 2,\n topCenter: 3,\n topRight: 4,\n middleRight: 5,\n bottomRight: 6,\n bottomCenter: 7,\n middleCenter: 8,\n} as const;\nexport type SVGAnchorPoint =\n (typeof SVGAnchorPoint)[keyof typeof SVGAnchorPoint];\n","import { SVGAttributes } from \"../attributes\";\nimport { SVGAnchorPoint } from \"../util/anchorPoint\";\nimport { create_svg_element } from \"./shared\";\n\n/**Creates a text nodes for an svg\n * @param x x coordinate of text\n * @param y y coordinate of text\n * @param text text\n * @param size size of text in px\n * @param anchor anchor point of text*/\nexport function text(\n x: number,\n y: number,\n text: string,\n size: number,\n anchor: SVGAnchorPoint,\n): SVGAttributes<SVGTextElement> {\n const text_elem = create_svg_element(\"text\")\n .a(\"x\", String(x))\n .a(\"y\", String(y))\n .a(\"font-size\", String(size));\n text_elem.elem.innerHTML = text;\n switch (anchor) {\n case SVGAnchorPoint.bottomLeft:\n case SVGAnchorPoint.middleLeft:\n case SVGAnchorPoint.topLeft: {\n text_elem.a(\"text-anchor\", \"start\");\n break;\n }\n case SVGAnchorPoint.topCenter:\n case SVGAnchorPoint.bottomCenter:\n case SVGAnchorPoint.middleCenter: {\n text_elem.a(\"text-anchor\", \"middle\");\n break;\n }\n case SVGAnchorPoint.topRight:\n case SVGAnchorPoint.middleRight:\n case SVGAnchorPoint.bottomRight: {\n text_elem.a(\"text-anchor\", \"end\");\n break;\n }\n }\n switch (anchor) {\n case SVGAnchorPoint.bottomLeft:\n case SVGAnchorPoint.bottomRight:\n case SVGAnchorPoint.bottomCenter: {\n text_elem.a(\"dominant-baseline\", \"auto\");\n break;\n }\n case SVGAnchorPoint.middleLeft:\n case SVGAnchorPoint.middleRight:\n case SVGAnchorPoint.middleCenter: {\n text_elem.a(\"dominant-baseline\", \"central\");\n break;\n }\n case SVGAnchorPoint.topLeft:\n case SVGAnchorPoint.topCenter:\n case SVGAnchorPoint.topRight: {\n text_elem.a(\"dominant-baseline\", \"hanging\");\n break;\n }\n }\n return text_elem;\n}\n\n/**Creates a text nodes for an svg\n * @param x x coordinate of text\n * @param y y coordinate of text\n * @param width width of text\n * @param height height of text\n * @param text text\n * @param size size of text in px\n * @param anchor anchor point of */\nexport function multi_line_text(\n x: number,\n y: number,\n width: number,\n height: number,\n text: string,\n size: number,\n anchor: SVGAnchorPoint,\n): SVGAttributes<SVGForeignObjectElement> {\n const text_element = create_svg_element(\"foreignObject\");\n const text_div = text_element.elem.appendChild(document.createElement(\"div\"));\n text_element.a(\"width\", String(width));\n text_element.a(\"height\", String(height));\n text_element.a(\"x\", String(x));\n text_element.a(\"y\", String(y));\n text_div.style.fontSize = size + \"px\";\n text_div.style.width = \"100%\";\n text_div.style.height = \"100%\";\n text_div.style.display = \"flex\";\n text_div.innerHTML = text;\n switch (anchor) {\n case SVGAnchorPoint.bottomLeft:\n case SVGAnchorPoint.middleLeft:\n case SVGAnchorPoint.topLeft: {\n text_div.style.textAlign = \"start\";\n text_div.style.justifyContent = \"flex-start\";\n break;\n }\n case SVGAnchorPoint.topCenter:\n case SVGAnchorPoint.bottomCenter:\n case SVGAnchorPoint.middleCenter: {\n text_div.style.textAlign = \"center\";\n text_div.style.justifyContent = \"center\";\n break;\n }\n case SVGAnchorPoint.topRight:\n case SVGAnchorPoint.middleRight:\n case SVGAnchorPoint.bottomRight: {\n text_div.style.textAlign = \"end\";\n text_div.style.justifyContent = \"flex-end\";\n break;\n }\n }\n switch (anchor) {\n case SVGAnchorPoint.bottomLeft:\n case SVGAnchorPoint.bottomRight:\n case SVGAnchorPoint.bottomCenter: {\n text_div.style.alignItems = \"flex-end\";\n break;\n }\n case SVGAnchorPoint.middleLeft:\n case SVGAnchorPoint.middleRight:\n case SVGAnchorPoint.middleCenter: {\n text_div.style.alignItems = \"center\";\n break;\n }\n case SVGAnchorPoint.topLeft:\n case SVGAnchorPoint.topCenter:\n case SVGAnchorPoint.topRight: {\n text_div.style.alignItems = \"flex-start\";\n break;\n }\n }\n return text_element;\n}\n","import { SVGAttributes } from \"../attributes\";\nimport { create_svg_element } from \"./shared\";\n\n/**This draws a triangle\n * @param center_x x coordinate of center\n * @param center_y y coordinate of center\n * @param width width\n * @param height height*/\nexport function isosceles_triangle(\n center_x: number,\n center_y: number,\n width: number,\n height: number,\n): SVGAttributes<SVGPathElement> {\n const half_w = width / 2;\n const half_h = height / 2;\n return create_svg_element(\"path\").a(\n \"d\",\n \"M\" +\n (center_x - half_w) +\n \",\" +\n (center_y + half_h) +\n \" \" +\n (center_x + half_w) +\n \",\" +\n (center_y + half_h) +\n \" \" +\n center_x +\n \",\" +\n (center_y - half_h) +\n \"Z\",\n );\n}\n","import { SVGAnchorPoint } from \"./anchorPoint\";\n\n/**Converts an angle to an anchor point\n * @param angle angle in radians*/\nexport const angle_to_anchor_point = (angle: number) => {\n const sec =\n angle >= 0 ? angle % 6.283185307179586 : -(angle % 6.283185307179586);\n if (sec > 5.93411945678072) {\n return SVGAnchorPoint.middleRight;\n } else if (sec > 4.974188368183839) {\n return SVGAnchorPoint.topRight;\n } else if (sec > 4.45058959258554) {\n return SVGAnchorPoint.topCenter;\n } else if (sec > 3.4906585039886591) {\n return SVGAnchorPoint.topLeft;\n } else if (sec > 2.792526803190927) {\n return SVGAnchorPoint.middleLeft;\n } else if (sec > 1.832595714594046) {\n return SVGAnchorPoint.bottomLeft;\n } else if (sec > 1.308996938995747) {\n return SVGAnchorPoint.bottomCenter;\n } else if (sec > 0.3490658503988659) {\n return SVGAnchorPoint.bottomRight;\n } else {\n return SVGAnchorPoint.middleRight;\n }\n};\n","import { SVGAttributes } from \"./attributes\";\nimport { circle, circle_arc } from \"./primitives/circle\";\nimport { ellipse, ellipse_arc } from \"./primitives/ellipse\";\nimport { group } from \"./primitives/group\";\nimport { line } from \"./primitives/line\";\nimport { path } from \"./primitives/path\";\nimport {\n rectangle_from_center,\n rectangle_from_corner,\n} from \"./primitives/rectangle\";\nimport { create_svg_element } from \"./primitives/shared\";\nimport { svg as svgsvg } from \"./primitives/svg\";\nimport { multi_line_text, text } from \"./primitives/text\";\nimport { isosceles_triangle } from \"./primitives/triangle\";\nimport { angle_to_anchor_point } from \"./util/angleToAnchorPoint\";\n\nexport const svg = {\n create: create_svg_element,\n attr: (elem: SVGElement) => new SVGAttributes(elem),\n //Primitives\n circle: circle,\n circle_arc: circle_arc,\n ellipse: ellipse,\n ellipse_arc: ellipse_arc,\n group: group,\n line: line,\n path: path,\n rectangle_from_center: rectangle_from_center,\n rectangle_from_corner: rectangle_from_corner,\n svg: svgsvg,\n text: text,\n multi_line_text: multi_line_text,\n isosceles_triangle: isosceles_triangle,\n //Utilities\n angle_to_anchor_point: angle_to_anchor_point,\n};\n\nexport type SVGFunc = () => SVGSVGElement;\nexport { SVGAnchorPoint } from \"./util/anchorPoint\";\n\ndeclare global {\n /**Types enum icons in @chocbite/ts-lib state as SVGFunc*/\n interface ChocbiteStateRegister {\n icon: SVGFunc;\n }\n}\n"],"mappings":";;;AAAA,IAAa,gBAAb,MAAiD;CAC/C,YAAY,MAAS;EACnB,KAAK,QAAQ;CACf;CACA;;CAEA,IAAI,OAAU;EACZ,KAAK,kBAAkB;EACvB,OAAO,KAAK;CACd;;CAGA,OAAO,QAAsB;EAC3B,KAAK,MAAM,aAAa,UAAU,MAAM;EACxC,OAAO;CACT;;CAEA,EAAE,QAAsB;EACtB,KAAK,MAAM,aAAa,UAAU,MAAM;EACxC,OAAO;CACT;;CAGA,KAAK,MAAoB;EACvB,KAAK,MAAM,aAAa,QAAQ,IAAI;EACpC,OAAO;CACT;;CAEA,EAAE,MAAoB;EACpB,KAAK,MAAM,aAAa,QAAQ,IAAI;EACpC,OAAO;CACT;;CAGA,aAAa,OAAqB;EAChC,KAAK,MAAM,aAAa,gBAAgB,OAAO,KAAK,CAAC;EACrD,OAAO;CACT;;CAEA,GAAG,OAAqB;EACtB,KAAK,MAAM,aAAa,gBAAgB,OAAO,KAAK,CAAC;EACrD,OAAO;CACT;;CAGA,WAAW,GAAG,YAA4B;EACxC,KAAK,MAAM,UAAU,IAAI,GAAG,UAAU;EACtC,OAAO;CACT;;CAEA,GAAG,GAAG,YAA4B;EAChC,KAAK,MAAM,UAAU,IAAI,GAAG,UAAU;EACtC,OAAO;CACT;;CAGA,UAAU,MAAc,OAAqB;EAC3C,KAAK,MAAM,aAAa,MAAM,KAAK;EACnC,OAAO;CACT;;CAEA,EAAE,MAAc,OAAqB;EACnC,KAAK,MAAM,aAAa,MAAM,KAAK;EACnC,OAAO;CACT;CAEA,cAAwB,CAAC;CACzB,oBAA0B;EACxB,IAAI,KAAK,YAAY,SAAS,GAC5B,KAAK,MAAM,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1
+ import '../style.css';
2
+ import { t as SVGFunc } from "../index-BcidwqIy.mjs";
3
+ export declare const BUILT_IN = 0;
4
+ export declare const Themes: {
5
+ readonly Light: "light";
6
+ readonly Dark: "dark";
7
+ };
8
+ export type Themes = (typeof Themes)[keyof typeof Themes];
9
+ export declare const THEME: import("@chocbite/ts-lib/state").StateROSW<Themes, import("@chocbite/ts-lib/result").OptionSome<import("@chocbite/ts-lib/state").StateEnumRelated<{
10
+ light: {
11
+ name: string;
12
+ description?: string;
13
+ icon?: SVGFunc;
14
+ };
15
+ dark: {
16
+ name: string;
17
+ description?: string;
18
+ icon?: SVGFunc;
19
+ };
20
+ }>>, Themes>;
21
+ export declare const SCALE: import("@chocbite/ts-lib/state").StateROSW<number, import("@chocbite/ts-lib/result").OptionSome<import("@chocbite/ts-lib/state").StateNumberRelated>, number>;
22
+ export declare const ScrollbarModes: {
23
+ readonly Thin: "thin";
24
+ readonly Medium: "medium";
25
+ readonly Wide: "wide";
26
+ };
27
+ export type ScrollbarModes = (typeof ScrollbarModes)[keyof typeof ScrollbarModes];
28
+ export declare const SCROLLBAR_MODE: import("@chocbite/ts-lib/state").StateROSW<ScrollbarModes, import("@chocbite/ts-lib/result").OptionSome<import("@chocbite/ts-lib/state").StateEnumRelated<{
29
+ thin: {
30
+ name: string;
31
+ description?: string;
32
+ icon?: SVGFunc;
33
+ };
34
+ medium: {
35
+ name: string;
36
+ description?: string;
37
+ icon?: SVGFunc;
38
+ };
39
+ wide: {
40
+ name: string;
41
+ description?: string;
42
+ icon?: SVGFunc;
43
+ };
44
+ }>>, ScrollbarModes>;
45
+ export declare const InputModes: {
46
+ readonly Mouse: "mouse";
47
+ readonly Pen: "pen";
48
+ readonly Touch: "touch";
49
+ };
50
+ export type InputModes = (typeof InputModes)[keyof typeof InputModes];
51
+ export declare const INPUT_MODE: import("@chocbite/ts-lib/state").StateROSW<InputModes, import("@chocbite/ts-lib/result").OptionSome<import("@chocbite/ts-lib/state").StateEnumRelated<{
52
+ mouse: {
53
+ name: string;
54
+ description?: string;
55
+ icon?: SVGFunc;
56
+ };
57
+ pen: {
58
+ name: string;
59
+ description?: string;
60
+ icon?: SVGFunc;
61
+ };
62
+ touch: {
63
+ name: string;
64
+ description?: string;
65
+ icon?: SVGFunc;
66
+ };
67
+ }>>, InputModes>;
68
+ export declare const AnimationLevels: {
69
+ readonly All: "all";
70
+ readonly Some: "some";
71
+ readonly None: "none";
72
+ };
73
+ export type AnimationLevels = (typeof AnimationLevels)[keyof typeof AnimationLevels];
74
+ export declare const ANIMATION_LEVEL: import("@chocbite/ts-lib/state").StateROSW<AnimationLevels, import("@chocbite/ts-lib/result").OptionSome<import("@chocbite/ts-lib/state").StateEnumRelated<{
75
+ none: {
76
+ name: string;
77
+ description?: string;
78
+ icon?: SVGFunc;
79
+ };
80
+ some: {
81
+ name: string;
82
+ description?: string;
83
+ icon?: SVGFunc;
84
+ };
85
+ all: {
86
+ name: string;
87
+ description?: string;
88
+ icon?: SVGFunc;
89
+ };
90
+ }>>, AnimationLevels>;
91
+ export declare const ANIMATION_SPEED: import("@chocbite/ts-lib/state").StateROSW<number, import("@chocbite/ts-lib/result").OptionSome<import("@chocbite/ts-lib/state").StateNumberRelated>, number>;
92
+ /**Converts the given rems to pixels */
93
+ export declare function rem_to_px(rem: number): number;
94
+ /**Converts the given pixels to rems */
95
+ export declare function px_to_rem(px: number): number;
96
+ /**Initialises the settings for the package
97
+ * @param package_name use import {name} from "../package.json"
98
+ * @param name name of group formatted for user reading
99
+ * @param description a description of what the setting group is about*/
100
+ export declare const theme_init_variable_root: (package_name: string, name: string, description: string) => ThemeVariableGroup;
101
+ /**Group of settings should never be instantiated manually use initSettings*/
102
+ export declare class ThemeVariableGroup {
103
+ private path_id;
104
+ private variables;
105
+ private sub_groups;
106
+ readonly name: string;
107
+ readonly description: string;
108
+ constructor(path: string, name: string, description: string);
109
+ /**Makes a variable subgroup for this group
110
+ * @param id unique identifier for this subgroup in the parent group
111
+ * @param name name of group formatted for user reading
112
+ * @param description a description of what the setting group is about formatted for user reading*/
113
+ make_sub_group(id: string, name: string, description: string): ThemeVariableGroup;
114
+ /**Makes a variable
115
+ * @param id unique identifier for this variable in the group
116
+ * @param name name of variable formatted for user reading
117
+ * @param description a description of what the variable is about formatted for user reading
118
+ * @param light value for light mode
119
+ * @param dark value for dark mode
120
+ * @param type type of variable for editing
121
+ * @param type_params */
122
+ make_variable<K extends keyof VariableType>(id: string, name: string, description: string, light: string, dark: string, type: K, type_params: VariableType[K], example?: () => Element): string;
123
+ /**Applies the groups
124
+ * @param style unique identifier for this variable in the group
125
+ * @param theme name of variable formatted for user reading*/
126
+ apply_themes(style: CSSStyleDeclaration, theme: string): void;
127
+ }
128
+ /**Defines the parameters for a variable type */
129
+ interface VariableType {
130
+ /**Font variable, */
131
+ Font: undefined;
132
+ /**Text variable, */
133
+ String: undefined;
134
+ /**Color variable */
135
+ Color: undefined;
136
+ /**Transition type */
137
+ TransitionType: undefined;
138
+ /**Percent type */
139
+ Percent: undefined;
140
+ /**Filter type */
141
+ Filter: undefined;
142
+ /**Radius type */
143
+ Radius: undefined;
144
+ /**Time variable */
145
+ Time: {
146
+ /**Minimum time in milliseconds */
147
+ min: number;
148
+ /**Maximum time in milliseconds */
149
+ max: number;
150
+ };
151
+ /**Angle variable */
152
+ Angle: {
153
+ min: number;
154
+ max: number;
155
+ };
156
+ /**Length variable*/
157
+ Length: {
158
+ min: number;
159
+ max: number;
160
+ };
161
+ /**Number variable*/
162
+ Number: {
163
+ min: number;
164
+ max: number;
165
+ };
166
+ /**Ratio*/
167
+ Ratio: {
168
+ width: {
169
+ min: number;
170
+ max: number;
171
+ };
172
+ height: {
173
+ min: number;
174
+ max: number;
175
+ };
176
+ } | number;
177
+ }
178
+ export {};
179
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1,2 @@
1
+ import "../style.css";
2
+ export { o as ANIMATION_LEVEL, s as ANIMATION_SPEED, c as AnimationLevels, t as BUILT_IN, l as INPUT_MODE, u as InputModes, d as SCALE, f as SCROLLBAR_MODE, p as ScrollbarModes, m as THEME, n as ThemeVariableGroup, h as Themes, i as px_to_rem, a as rem_to_px, r as theme_init_variable_root } from "../theme-DhIVwHQw.mjs";
@@ -0,0 +1,39 @@
1
+ @mixin scrollbar {
2
+ &::-webkit-scrollbar {
3
+ width: calc(var(--scrollbar));
4
+ height: calc(var(--scrollbar));
5
+ }
6
+
7
+ &::-webkit-scrollbar-thumb {
8
+ background-color: var(--common-scrollbar-thumb-color);
9
+ border-radius: 100vh;
10
+ border: calc(var(--scrollbar) / 5) solid transparent;
11
+ -webkit-background-clip: padding-box;
12
+ background-clip: padding-box;
13
+ }
14
+
15
+ &::-webkit-scrollbar-thumb:hover {
16
+ background-color: var(--common-scrollbar-thumb-hoverColor);
17
+ border: calc(var(--scrollbar) / 5) solid transparent;
18
+ }
19
+
20
+ &::-webkit-scrollbar-thumb:active {
21
+ background-color: var(--common-scrollbar-thumb-activeColor);
22
+ border: calc(var(--scrollbar) / 5) solid transparent;
23
+ }
24
+
25
+ &::-webkit-scrollbar-corner {
26
+ background: transparent;
27
+ }
28
+
29
+ &::-webkit-scrollbar-button:vertical:start:increment,
30
+ &::-webkit-scrollbar-button:vertical:end:decrement,
31
+ &::-webkit-scrollbar-button:horizontal:start:increment,
32
+ &::-webkit-scrollbar-button:horizontal:end:decrement,
33
+ &::-webkit-scrollbar-button:vertical:end:increment,
34
+ &::-webkit-scrollbar-button:vertical:start:decrement,
35
+ &::-webkit-scrollbar-button:horizontal:end:increment,
36
+ &::-webkit-scrollbar-button:horizontal:start:decrement {
37
+ display: none;
38
+ }
39
+ }