@netless/fastboard-ui 0.3.2-canary.5 → 0.3.3

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 (110) hide show
  1. package/LICENSE.txt +21 -21
  2. package/README.md +7 -7
  3. package/dist/index.d.ts +102 -102
  4. package/dist/index.js +30 -23
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +30 -23
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/index.svelte.mjs +22 -17
  9. package/dist/index.svelte.mjs.map +1 -1
  10. package/package.json +4 -5
  11. package/src/actions/height.ts +43 -43
  12. package/src/actions/scroll.ts +31 -31
  13. package/src/actions/tippy.ts +71 -71
  14. package/src/behaviors/apps.ts +74 -74
  15. package/src/behaviors/index.ts +1 -1
  16. package/src/components/Button/Button.svelte +51 -51
  17. package/src/components/Button/Button.svelte.d.ts +26 -26
  18. package/src/components/Button/index.ts +2 -2
  19. package/src/components/Fastboard/Fastboard.scss +61 -61
  20. package/src/components/Fastboard/Fastboard.svelte +80 -80
  21. package/src/components/Fastboard/Fastboard.svelte.ts +14 -14
  22. package/src/components/Fastboard/ReplayFastboard.svelte +43 -43
  23. package/src/components/Fastboard/ReplayFastboard.svelte.ts +13 -13
  24. package/src/components/Fastboard/index.ts +5 -5
  25. package/src/components/Icon/Icon.svelte +11 -11
  26. package/src/components/Icon/Icon.svelte.d.ts +10 -10
  27. package/src/components/Icon/index.ts +2 -2
  28. package/src/components/Icons/Apps.svelte +49 -49
  29. package/src/components/Icons/Arrow.svelte +16 -16
  30. package/src/components/Icons/ArrowBolded.svelte +17 -17
  31. package/src/components/Icons/Balloon.svelte +16 -16
  32. package/src/components/Icons/BalloonBolded.svelte +16 -16
  33. package/src/components/Icons/Circle.svelte +20 -20
  34. package/src/components/Icons/CircleBolded.svelte +20 -20
  35. package/src/components/Icons/Clean.svelte +14 -14
  36. package/src/components/Icons/Clear.svelte +16 -16
  37. package/src/components/Icons/Click.svelte +16 -16
  38. package/src/components/Icons/ClickFilled.svelte +10 -10
  39. package/src/components/Icons/Diamond.svelte +16 -16
  40. package/src/components/Icons/Down.svelte +16 -16
  41. package/src/components/Icons/Eraser.svelte +16 -16
  42. package/src/components/Icons/EraserFilled.svelte +16 -16
  43. package/src/components/Icons/Icons.scss +20 -20
  44. package/src/components/Icons/Left.svelte +16 -16
  45. package/src/components/Icons/Line.svelte +16 -16
  46. package/src/components/Icons/LineBolded.svelte +16 -16
  47. package/src/components/Icons/Loading.svelte +10 -10
  48. package/src/components/Icons/Minus.svelte +16 -16
  49. package/src/components/Icons/Pause.svelte +10 -10
  50. package/src/components/Icons/Pencil.svelte +29 -29
  51. package/src/components/Icons/PencilFilled.svelte +16 -16
  52. package/src/components/Icons/Play.svelte +10 -10
  53. package/src/components/Icons/Plus.svelte +16 -16
  54. package/src/components/Icons/Rectangle.svelte +16 -16
  55. package/src/components/Icons/RectangleBolded.svelte +16 -16
  56. package/src/components/Icons/Redo.svelte +15 -15
  57. package/src/components/Icons/Reset.svelte +26 -26
  58. package/src/components/Icons/Rhombus.svelte +16 -16
  59. package/src/components/Icons/RhombusBolded.svelte +16 -16
  60. package/src/components/Icons/Right.svelte +16 -16
  61. package/src/components/Icons/Selector.svelte +24 -24
  62. package/src/components/Icons/SelectorFilled.svelte +18 -18
  63. package/src/components/Icons/SpeechBalloon.svelte +16 -16
  64. package/src/components/Icons/Star.svelte +16 -16
  65. package/src/components/Icons/StarBolded.svelte +16 -16
  66. package/src/components/Icons/Text.svelte +16 -16
  67. package/src/components/Icons/TextFilled.svelte +17 -17
  68. package/src/components/Icons/Triangle.svelte +16 -16
  69. package/src/components/Icons/TriangleBolded.svelte +16 -16
  70. package/src/components/Icons/Undo.svelte +15 -15
  71. package/src/components/Icons/Up.svelte +16 -16
  72. package/src/components/Icons/WhiteboardAdd.svelte +34 -34
  73. package/src/components/Icons/index.ts +93 -93
  74. package/src/components/PageControl/PageControl.scss +15 -15
  75. package/src/components/PageControl/PageControl.svelte +79 -79
  76. package/src/components/PageControl/PageControl.svelte.d.ts +13 -13
  77. package/src/components/PageControl/index.ts +2 -2
  78. package/src/components/PlayerControl/PlayerControl.scss +57 -57
  79. package/src/components/PlayerControl/PlayerControl.svelte +153 -153
  80. package/src/components/PlayerControl/PlayerControl.svelte.d.ts +13 -13
  81. package/src/components/PlayerControl/index.ts +2 -2
  82. package/src/components/RedoUndo/RedoUndo.scss +11 -11
  83. package/src/components/RedoUndo/RedoUndo.svelte +60 -60
  84. package/src/components/RedoUndo/RedoUndo.svelte.d.ts +13 -13
  85. package/src/components/RedoUndo/index.ts +2 -2
  86. package/src/components/Toolbar/README.md +57 -57
  87. package/src/components/Toolbar/Toolbar.scss +78 -78
  88. package/src/components/Toolbar/Toolbar.svelte +62 -62
  89. package/src/components/Toolbar/Toolbar.svelte.d.ts +13 -13
  90. package/src/components/Toolbar/components/Contents.scss +168 -168
  91. package/src/components/Toolbar/components/Contents.svelte +202 -197
  92. package/src/components/Toolbar/components/Shapes.svelte +85 -85
  93. package/src/components/Toolbar/components/Slider.scss +119 -119
  94. package/src/components/Toolbar/components/Slider.svelte +54 -54
  95. package/src/components/Toolbar/components/StrokeColor.svelte +39 -39
  96. package/src/components/Toolbar/components/StrokeWidth.svelte +20 -20
  97. package/src/components/Toolbar/components/TextColor.svelte +39 -39
  98. package/src/components/Toolbar/components/constants.ts +80 -80
  99. package/src/components/Toolbar/components/helper.ts +24 -24
  100. package/src/components/Toolbar/index.ts +2 -2
  101. package/src/components/ZoomControl/ZoomControl.scss +15 -15
  102. package/src/components/ZoomControl/ZoomControl.svelte +99 -99
  103. package/src/components/ZoomControl/ZoomControl.svelte.d.ts +13 -13
  104. package/src/components/ZoomControl/index.ts +2 -2
  105. package/src/components/helpers.ts +3 -3
  106. package/src/components/theme.scss +92 -92
  107. package/src/components/variables.scss +69 -69
  108. package/src/index.ts +13 -13
  109. package/src/style.scss +36 -36
  110. package/src/typings.ts +38 -38
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/fastboard-ui",
3
- "version": "0.3.2-canary.5",
3
+ "version": "0.3.3",
4
4
  "description": "The front-end of @netless/fastboard-core.",
5
5
  "main": "dist/index.js",
6
6
  "svelte": "dist/index.svelte.mjs",
@@ -10,14 +10,14 @@
10
10
  ],
11
11
  "repository": "netless-io/fastboard",
12
12
  "peerDependencies": {
13
- "@netless/fastboard-core": "0.3.2-canary.5"
13
+ "@netless/fastboard-core": "0.3.3"
14
14
  },
15
15
  "dependencies": {
16
16
  "tippy.js": "^6.3.7"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@netless/esbuild-plugin-inline-sass": "0.1.0",
20
- "@netless/fastboard-core": "0.3.2-canary.5"
20
+ "@netless/fastboard-core": "0.3.3"
21
21
  },
22
22
  "scripts": {
23
23
  "cleanup": "rimraf dist",
@@ -27,6 +27,5 @@
27
27
  "test:ssr": "esbuild-dev test/ssr.ts"
28
28
  },
29
29
  "module": "dist/index.mjs",
30
- "types": "dist/index.d.ts",
31
- "readme": "## @netless/fastboard-ui\r\n\r\nThe front-end of [@netless/fastboard-core](https://github.com/netless-io/fastboard/tree/main/packages/fastboard-core).\r\n\r\n### License\r\n\r\nMIT @ [netless](https://github.com/netless-io)\r\n"
30
+ "types": "dist/index.d.ts"
32
31
  }
@@ -1,43 +1,43 @@
1
- import type { Writable } from "svelte/store";
2
- import type { SvelteAction } from "../typings";
3
-
4
- export const height: SvelteAction<Writable<number>> = function (node, height) {
5
- const styles = getComputedStyle(node);
6
- const paddings =
7
- (parseInt(styles.paddingTop) || 0) +
8
- (parseInt(styles.paddingBottom) || 0) +
9
- (parseInt(styles.borderTopWidth) || 0) +
10
- (parseInt(styles.borderBottomWidth) || 0);
11
-
12
- const observer = new ResizeObserver(() => {
13
- height.set(node.getBoundingClientRect().height - paddings);
14
- });
15
-
16
- observer.observe(node);
17
-
18
- return {
19
- update(new_height) {
20
- height = new_height;
21
- },
22
- destroy() {
23
- observer.disconnect();
24
- },
25
- };
26
- };
27
-
28
- export const scrollHeight: SvelteAction<Writable<number>> = function (node, height) {
29
- const observer = new ResizeObserver(() => {
30
- height.set(node.scrollHeight);
31
- });
32
-
33
- observer.observe(node);
34
-
35
- return {
36
- update(new_height) {
37
- height = new_height;
38
- },
39
- destroy() {
40
- observer.disconnect();
41
- },
42
- };
43
- };
1
+ import type { Writable } from "svelte/store";
2
+ import type { SvelteAction } from "../typings";
3
+
4
+ export const height: SvelteAction<Writable<number>> = function (node, height) {
5
+ const styles = getComputedStyle(node);
6
+ const paddings =
7
+ (parseInt(styles.paddingTop) || 0) +
8
+ (parseInt(styles.paddingBottom) || 0) +
9
+ (parseInt(styles.borderTopWidth) || 0) +
10
+ (parseInt(styles.borderBottomWidth) || 0);
11
+
12
+ const observer = new ResizeObserver(() => {
13
+ height.set(node.getBoundingClientRect().height - paddings);
14
+ });
15
+
16
+ observer.observe(node);
17
+
18
+ return {
19
+ update(new_height) {
20
+ height = new_height;
21
+ },
22
+ destroy() {
23
+ observer.disconnect();
24
+ },
25
+ };
26
+ };
27
+
28
+ export const scrollHeight: SvelteAction<Writable<number>> = function (node, height) {
29
+ const observer = new ResizeObserver(() => {
30
+ height.set(node.scrollHeight);
31
+ });
32
+
33
+ observer.observe(node);
34
+
35
+ return {
36
+ update(new_height) {
37
+ height = new_height;
38
+ },
39
+ destroy() {
40
+ observer.disconnect();
41
+ },
42
+ };
43
+ };
@@ -1,31 +1,31 @@
1
- import type { Writable } from "svelte/store";
2
- import type { SvelteAction } from "../typings";
3
-
4
- export const scrollTop: SvelteAction<Writable<number>> = function (node, value) {
5
- const listener = (top: number) => {
6
- node.scrollTo({ top, behavior: "smooth" });
7
- };
8
-
9
- let timer = 0;
10
-
11
- function on_scroll() {
12
- clearTimeout(timer);
13
- timer = setTimeout(() => value.set(node.scrollTop), 200);
14
- }
15
-
16
- node.addEventListener("scroll", on_scroll);
17
-
18
- let unsubscribe = value.subscribe(listener);
19
-
20
- return {
21
- update(new_value) {
22
- unsubscribe();
23
- unsubscribe = (value = new_value).subscribe(listener);
24
- },
25
- destroy() {
26
- clearTimeout(timer);
27
- node.removeEventListener("scroll", on_scroll);
28
- unsubscribe();
29
- },
30
- };
31
- };
1
+ import type { Writable } from "svelte/store";
2
+ import type { SvelteAction } from "../typings";
3
+
4
+ export const scrollTop: SvelteAction<Writable<number>> = function (node, value) {
5
+ const listener = (top: number) => {
6
+ node.scrollTo({ top, behavior: "smooth" });
7
+ };
8
+
9
+ let timer = 0;
10
+
11
+ function on_scroll() {
12
+ clearTimeout(timer);
13
+ timer = setTimeout(() => value.set(node.scrollTop), 200);
14
+ }
15
+
16
+ node.addEventListener("scroll", on_scroll);
17
+
18
+ let unsubscribe = value.subscribe(listener);
19
+
20
+ return {
21
+ update(new_value) {
22
+ unsubscribe();
23
+ unsubscribe = (value = new_value).subscribe(listener);
24
+ },
25
+ destroy() {
26
+ clearTimeout(timer);
27
+ node.removeEventListener("scroll", on_scroll);
28
+ unsubscribe();
29
+ },
30
+ };
31
+ };
@@ -1,71 +1,71 @@
1
- import type { Instance, Props } from "tippy.js";
2
- import type { SvelteAction } from "../typings";
3
- import { is_client } from "svelte/internal";
4
-
5
- import Tippy from "tippy.js";
6
-
7
- if (is_client) {
8
- Tippy.setDefaultProps({
9
- delay: [1000, 400],
10
- duration: 300,
11
- offset: [0, 11],
12
- theme: "dark",
13
- plugins: [
14
- {
15
- name: "className",
16
- defaultValue: "",
17
- fn(instance) {
18
- function add() {
19
- const el = instance.popper.firstElementChild;
20
- if (el) {
21
- el.classList.add("fastboard-tip");
22
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
- const extra = ((instance.props as any).className || "").trim();
24
- if (extra) {
25
- el.classList.add(extra);
26
- }
27
- }
28
- }
29
-
30
- function remove() {
31
- instance.popper.firstElementChild?.classList.remove("fastboard-tip");
32
- }
33
-
34
- return {
35
- onCreate: add,
36
- onBeforeUpdate: remove,
37
- onAfterUpdate: add,
38
- };
39
- },
40
- },
41
- ],
42
- });
43
- }
44
-
45
- export const tippy: SvelteAction<Partial<Props & { className: string }>> = function (node, props) {
46
- const instance = Tippy(node, props);
47
-
48
- return {
49
- update(props: Partial<Props & { className: string }>) {
50
- instance.setProps(props);
51
- },
52
- destroy() {
53
- instance.destroy();
54
- },
55
- };
56
- };
57
-
58
- export function tippy_hide_all() {
59
- document.querySelectorAll("[data-tippy-root]").forEach(el => {
60
- const instance = (el as unknown as { _tippy: Instance })._tippy;
61
- if (instance) instance.hide();
62
- });
63
- }
64
-
65
- export const tippy_menu: Partial<Props> = {
66
- delay: 0,
67
- duration: [50, 300],
68
- placement: "right-start",
69
- interactive: true,
70
- trigger: "click",
71
- };
1
+ import type { Instance, Props } from "tippy.js";
2
+ import type { SvelteAction } from "../typings";
3
+ import { is_client } from "svelte/internal";
4
+
5
+ import Tippy from "tippy.js";
6
+
7
+ if (is_client) {
8
+ Tippy.setDefaultProps({
9
+ delay: [1000, 400],
10
+ duration: 300,
11
+ offset: [0, 11],
12
+ theme: "dark",
13
+ plugins: [
14
+ {
15
+ name: "className",
16
+ defaultValue: "",
17
+ fn(instance) {
18
+ function add() {
19
+ const el = instance.popper.firstElementChild;
20
+ if (el) {
21
+ el.classList.add("fastboard-tip");
22
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
+ const extra = ((instance.props as any).className || "").trim();
24
+ if (extra) {
25
+ el.classList.add(extra);
26
+ }
27
+ }
28
+ }
29
+
30
+ function remove() {
31
+ instance.popper.firstElementChild?.classList.remove("fastboard-tip");
32
+ }
33
+
34
+ return {
35
+ onCreate: add,
36
+ onBeforeUpdate: remove,
37
+ onAfterUpdate: add,
38
+ };
39
+ },
40
+ },
41
+ ],
42
+ });
43
+ }
44
+
45
+ export const tippy: SvelteAction<Partial<Props & { className: string }>> = function (node, props) {
46
+ const instance = Tippy(node, props);
47
+
48
+ return {
49
+ update(props: Partial<Props & { className: string }>) {
50
+ instance.setProps(props);
51
+ },
52
+ destroy() {
53
+ instance.destroy();
54
+ },
55
+ };
56
+ };
57
+
58
+ export function tippy_hide_all() {
59
+ document.querySelectorAll("[data-tippy-root]").forEach(el => {
60
+ const instance = (el as unknown as { _tippy: Instance })._tippy;
61
+ if (instance) instance.hide();
62
+ });
63
+ }
64
+
65
+ export const tippy_menu: Partial<Props> = {
66
+ delay: 0,
67
+ duration: [50, 300],
68
+ placement: "right-start",
69
+ interactive: true,
70
+ trigger: "click",
71
+ };
@@ -1,74 +1,74 @@
1
- import type { FastboardApp } from "@netless/fastboard-core";
2
- import code_editor_svg from "./icons/visual-studio-code.svg";
3
- import geogebra_svg from "./icons/geogebra.svg";
4
- import countdown_svg from "./icons/countdown.svg";
5
-
6
- export interface AppInToolbar {
7
- kind: string;
8
- icon: string;
9
- label: string;
10
- onClick: (app: FastboardApp) => void;
11
- }
12
-
13
- class AppsInToolbar {
14
- _listeners: Array<(data: AppInToolbar[]) => void> = [];
15
- constructor(private _data: AppInToolbar[]) {}
16
- get data() {
17
- return this._data;
18
- }
19
- get length() {
20
- return this._data.length;
21
- }
22
- subscribe(fn: (data: AppInToolbar[]) => void) {
23
- this._listeners.push(fn);
24
- fn(this._data);
25
- return () => {
26
- this._listeners = this._listeners.filter(item => item !== fn);
27
- };
28
- }
29
- push(...data: AppInToolbar[]) {
30
- this._data.push(...data);
31
- this._listeners.forEach(fn => fn(this._data));
32
- }
33
- insert(data: AppInToolbar, index: number) {
34
- this._data.splice(index, 0, data);
35
- this._listeners.forEach(fn => fn(this._data));
36
- }
37
- delete(filter: (data: AppInToolbar) => boolean) {
38
- this._data = this._data.filter(item => !filter(item));
39
- this._listeners.forEach(fn => fn(this._data));
40
- }
41
- clear() {
42
- this._data.length = 0;
43
- this._listeners.forEach(fn => fn(this._data));
44
- }
45
- }
46
-
47
- export type { AppsInToolbar };
48
-
49
- export const apps = new AppsInToolbar([
50
- {
51
- kind: "Monaco",
52
- icon: code_editor_svg,
53
- label: "Code Editor",
54
- onClick(app) {
55
- app.insertCodeEditor();
56
- },
57
- },
58
- {
59
- kind: "GeoGebra",
60
- icon: geogebra_svg,
61
- label: "GeoGebra",
62
- onClick(app) {
63
- app.insertGeoGebra();
64
- },
65
- },
66
- {
67
- kind: "Countdown",
68
- icon: countdown_svg,
69
- label: "Countdown",
70
- onClick(app) {
71
- app.insertCountdown();
72
- },
73
- },
74
- ]);
1
+ import type { FastboardApp } from "@netless/fastboard-core";
2
+ import code_editor_svg from "./icons/visual-studio-code.svg";
3
+ import geogebra_svg from "./icons/geogebra.svg";
4
+ import countdown_svg from "./icons/countdown.svg";
5
+
6
+ export interface AppInToolbar {
7
+ kind: string;
8
+ icon: string;
9
+ label: string;
10
+ onClick: (app: FastboardApp) => void;
11
+ }
12
+
13
+ class AppsInToolbar {
14
+ _listeners: Array<(data: AppInToolbar[]) => void> = [];
15
+ constructor(private _data: AppInToolbar[]) {}
16
+ get data() {
17
+ return this._data;
18
+ }
19
+ get length() {
20
+ return this._data.length;
21
+ }
22
+ subscribe(fn: (data: AppInToolbar[]) => void) {
23
+ this._listeners.push(fn);
24
+ fn(this._data);
25
+ return () => {
26
+ this._listeners = this._listeners.filter(item => item !== fn);
27
+ };
28
+ }
29
+ push(...data: AppInToolbar[]) {
30
+ this._data.push(...data);
31
+ this._listeners.forEach(fn => fn(this._data));
32
+ }
33
+ insert(data: AppInToolbar, index: number) {
34
+ this._data.splice(index, 0, data);
35
+ this._listeners.forEach(fn => fn(this._data));
36
+ }
37
+ delete(filter: (data: AppInToolbar) => boolean) {
38
+ this._data = this._data.filter(item => !filter(item));
39
+ this._listeners.forEach(fn => fn(this._data));
40
+ }
41
+ clear() {
42
+ this._data.length = 0;
43
+ this._listeners.forEach(fn => fn(this._data));
44
+ }
45
+ }
46
+
47
+ export type { AppsInToolbar };
48
+
49
+ export const apps = new AppsInToolbar([
50
+ {
51
+ kind: "Monaco",
52
+ icon: code_editor_svg,
53
+ label: "Code Editor",
54
+ onClick(app) {
55
+ app.insertCodeEditor();
56
+ },
57
+ },
58
+ {
59
+ kind: "GeoGebra",
60
+ icon: geogebra_svg,
61
+ label: "GeoGebra",
62
+ onClick(app) {
63
+ app.insertGeoGebra();
64
+ },
65
+ },
66
+ {
67
+ kind: "Countdown",
68
+ icon: countdown_svg,
69
+ label: "Countdown",
70
+ onClick(app) {
71
+ app.insertCountdown();
72
+ },
73
+ },
74
+ ]);
@@ -1 +1 @@
1
- export * from "./apps";
1
+ export * from "./apps";
@@ -1,51 +1,51 @@
1
- <script lang="ts">
2
- import type { Content, Placement } from "tippy.js";
3
- import type { Theme } from "../../typings";
4
- import { tippy, tippy_menu } from "../../actions/tippy";
5
-
6
- let className = "";
7
- export { className as class };
8
- export let name = "fastboard-ui";
9
- export let theme: Theme = "light";
10
- export let disabled = false;
11
- export let content: Content = "";
12
- export let placement: Placement = "top";
13
- export let menu: Content = "";
14
- export let menu_placement: Placement = "right-start";
15
- </script>
16
-
17
- {#if content}
18
- {#if menu}
19
- <span class="{name}-btn-interactive {theme}" use:tippy={{ content, placement, className }}>
20
- <button
21
- class="{name}-btn {className} {theme}"
22
- {disabled}
23
- on:click
24
- use:tippy={{
25
- content: menu,
26
- ...tippy_menu,
27
- placement: menu_placement,
28
- appendTo: document.body,
29
- theme,
30
- className: "fastboard-panel",
31
- }}
32
- >
33
- <slot />
34
- </button>
35
- <span class="{name}-triangle" />
36
- </span>
37
- {:else}
38
- <button
39
- class="{name}-btn {className} {theme}"
40
- {disabled}
41
- on:click
42
- use:tippy={{ content, placement, className }}
43
- >
44
- <slot />
45
- </button>
46
- {/if}
47
- {:else}
48
- <button class="{name}-btn {className} {theme}" {disabled} on:click>
49
- <slot />
50
- </button>
51
- {/if}
1
+ <script lang="ts">
2
+ import type { Content, Placement } from "tippy.js";
3
+ import type { Theme } from "../../typings";
4
+ import { tippy, tippy_menu } from "../../actions/tippy";
5
+
6
+ let className = "";
7
+ export { className as class };
8
+ export let name = "fastboard-ui";
9
+ export let theme: Theme = "light";
10
+ export let disabled = false;
11
+ export let content: Content = "";
12
+ export let placement: Placement = "top";
13
+ export let menu: Content = "";
14
+ export let menu_placement: Placement = "right-start";
15
+ </script>
16
+
17
+ {#if content}
18
+ {#if menu}
19
+ <span class="{name}-btn-interactive {theme}" use:tippy={{ content, placement, className }}>
20
+ <button
21
+ class="{name}-btn {className} {theme}"
22
+ {disabled}
23
+ on:click
24
+ use:tippy={{
25
+ content: menu,
26
+ ...tippy_menu,
27
+ placement: menu_placement,
28
+ appendTo: document.body,
29
+ theme,
30
+ className: "fastboard-panel",
31
+ }}
32
+ >
33
+ <slot />
34
+ </button>
35
+ <span class="{name}-triangle" />
36
+ </span>
37
+ {:else}
38
+ <button
39
+ class="{name}-btn {className} {theme}"
40
+ {disabled}
41
+ on:click
42
+ use:tippy={{ content, placement, className }}
43
+ >
44
+ <slot />
45
+ </button>
46
+ {/if}
47
+ {:else}
48
+ <button class="{name}-btn {className} {theme}" {disabled} on:click>
49
+ <slot />
50
+ </button>
51
+ {/if}
@@ -1,26 +1,26 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- import type { Content, Placement } from "tippy.js";
3
- import type { Theme } from "../../typings";
4
-
5
- export declare interface ButtonProps {
6
- class?: string;
7
- name?: string;
8
- theme?: Theme;
9
- disabled?: boolean;
10
- content?: Content;
11
- placement?: Placement;
12
- menu?: Content;
13
- menu_placement?: Placement;
14
- }
15
-
16
- export declare interface ButtonEvents {
17
- click: WindowEventMap["click"];
18
- }
19
-
20
- export declare interface ButtonSlots {
21
- // eslint-disable-next-line @typescript-eslint/ban-types
22
- default: {};
23
- }
24
-
25
- declare class Button extends SvelteComponentTyped<ButtonProps, ButtonEvents, ButtonSlots> {}
26
- export default Button;
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { Content, Placement } from "tippy.js";
3
+ import type { Theme } from "../../typings";
4
+
5
+ export declare interface ButtonProps {
6
+ class?: string;
7
+ name?: string;
8
+ theme?: Theme;
9
+ disabled?: boolean;
10
+ content?: Content;
11
+ placement?: Placement;
12
+ menu?: Content;
13
+ menu_placement?: Placement;
14
+ }
15
+
16
+ export declare interface ButtonEvents {
17
+ click: WindowEventMap["click"];
18
+ }
19
+
20
+ export declare interface ButtonSlots {
21
+ // eslint-disable-next-line @typescript-eslint/ban-types
22
+ default: {};
23
+ }
24
+
25
+ declare class Button extends SvelteComponentTyped<ButtonProps, ButtonEvents, ButtonSlots> {}
26
+ export default Button;
@@ -1,2 +1,2 @@
1
- export { default } from "./Button.svelte";
2
- export * from "./Button.svelte";
1
+ export { default } from "./Button.svelte";
2
+ export * from "./Button.svelte";