@websline/system-components 1.3.11 → 1.3.13

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.
@@ -0,0 +1,27 @@
1
+ <script>
2
+ /**
3
+ * @typedef {Object} Props
4
+ * @property {string} [color=""] Icon color
5
+ * @property {number} [height=24] Icon height
6
+ * @property {number} [strokeWidth=24] Icon StrokeWidth
7
+ * @property {number} [width=24] Icon width
8
+ */
9
+
10
+ /** @type {Props} */
11
+ let { color, height, width, strokeWidth, ...rest } = $props();
12
+ </script>
13
+
14
+ <svg
15
+ {height}
16
+ {width}
17
+ viewBox="0 0 24 24"
18
+ fill="none"
19
+ xmlns="http://www.w3.org/2000/svg"
20
+ {...rest}>
21
+ <path
22
+ d="M2.99998 18V20M21 18V20M3.99995 6.5C3.99995 5.67155 4.67153 5 5.49995 5H18.5C19.3284 5 20 5.67155 20 6.5V12H3.99995V6.5ZM14.5 9.5H9.5C8.67155 9.5 8 10.1715 8 11V12H16V11C16 10.1715 15.3285 9.5 14.5 9.5ZM2 13.5C2 12.6715 2.67158 12 3.5 12H20.5C21.3285 12 22 12.6715 22 13.5V18H2V13.5Z"
23
+ stroke={color}
24
+ stroke-width={strokeWidth}
25
+ stroke-linecap="round"
26
+ stroke-linejoin="round" />
27
+ </svg>
@@ -0,0 +1,41 @@
1
+ export default Bed;
2
+ type Bed = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<Props>): void;
5
+ };
6
+ declare const Bed: import("svelte").Component<{
7
+ /**
8
+ * Icon color
9
+ */
10
+ color?: string;
11
+ /**
12
+ * Icon height
13
+ */
14
+ height?: number;
15
+ /**
16
+ * Icon StrokeWidth
17
+ */
18
+ strokeWidth?: number;
19
+ /**
20
+ * Icon width
21
+ */
22
+ width?: number;
23
+ }, {}, "">;
24
+ type Props = {
25
+ /**
26
+ * Icon color
27
+ */
28
+ color?: string;
29
+ /**
30
+ * Icon height
31
+ */
32
+ height?: number;
33
+ /**
34
+ * Icon StrokeWidth
35
+ */
36
+ strokeWidth?: number;
37
+ /**
38
+ * Icon width
39
+ */
40
+ width?: number;
41
+ };
@@ -0,0 +1,27 @@
1
+ <script>
2
+ /**
3
+ * @typedef {Object} Props
4
+ * @property {string} [color=""] Icon color
5
+ * @property {number} [height=24] Icon height
6
+ * @property {number} [strokeWidth=24] Icon StrokeWidth
7
+ * @property {number} [width=24] Icon width
8
+ */
9
+
10
+ /** @type {Props} */
11
+ let { color, height, width, strokeWidth, ...rest } = $props();
12
+ </script>
13
+
14
+ <svg
15
+ {height}
16
+ {width}
17
+ viewBox="0 0 24 24"
18
+ fill="none"
19
+ xmlns="http://www.w3.org/2000/svg"
20
+ {...rest}>
21
+ <path
22
+ d="M4.50006 8.00007L17 3.00006L19.0002 8.00007M8.5 12.6924H11.5M8.5 15.6924H15.5M2 8.00002H22V11C20.5 11 19 12 19 13.75C19 15.5 20.5 17 22 17V20H2V17C3.50008 17 5 16 5 14C5 12 3.5 11 2 11V8.00002Z"
23
+ stroke={color}
24
+ stroke-width={strokeWidth}
25
+ stroke-linecap="round"
26
+ stroke-linejoin="round" />
27
+ </svg>
@@ -0,0 +1,41 @@
1
+ export default Coupons;
2
+ type Coupons = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<Props>): void;
5
+ };
6
+ declare const Coupons: import("svelte").Component<{
7
+ /**
8
+ * Icon color
9
+ */
10
+ color?: string;
11
+ /**
12
+ * Icon height
13
+ */
14
+ height?: number;
15
+ /**
16
+ * Icon StrokeWidth
17
+ */
18
+ strokeWidth?: number;
19
+ /**
20
+ * Icon width
21
+ */
22
+ width?: number;
23
+ }, {}, "">;
24
+ type Props = {
25
+ /**
26
+ * Icon color
27
+ */
28
+ color?: string;
29
+ /**
30
+ * Icon height
31
+ */
32
+ height?: number;
33
+ /**
34
+ * Icon StrokeWidth
35
+ */
36
+ strokeWidth?: number;
37
+ /**
38
+ * Icon width
39
+ */
40
+ width?: number;
41
+ };
@@ -0,0 +1,27 @@
1
+ <script>
2
+ /**
3
+ * @typedef {Object} Props
4
+ * @property {string} [color=""] Icon color
5
+ * @property {number} [height=24] Icon height
6
+ * @property {number} [strokeWidth=24] Icon StrokeWidth
7
+ * @property {number} [width=24] Icon width
8
+ */
9
+
10
+ /** @type {Props} */
11
+ let { color, height, width, strokeWidth, ...rest } = $props();
12
+ </script>
13
+
14
+ <svg
15
+ {height}
16
+ {width}
17
+ viewBox="0 0 24 24"
18
+ fill="none"
19
+ xmlns="http://www.w3.org/2000/svg"
20
+ {...rest}>
21
+ <path
22
+ d="M5 3H19M5 21H19M7 3V8.45455L11 13M17 21V14.6957L14 11M7 21V14.8537L9 12M17 3V8.53846L15 12M9 16H10M12 18H13"
23
+ stroke={color}
24
+ stroke-width={strokeWidth}
25
+ stroke-linecap="round"
26
+ stroke-linejoin="round" />
27
+ </svg>
@@ -0,0 +1,41 @@
1
+ export default Hourglass;
2
+ type Hourglass = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<Props>): void;
5
+ };
6
+ declare const Hourglass: import("svelte").Component<{
7
+ /**
8
+ * Icon color
9
+ */
10
+ color?: string;
11
+ /**
12
+ * Icon height
13
+ */
14
+ height?: number;
15
+ /**
16
+ * Icon StrokeWidth
17
+ */
18
+ strokeWidth?: number;
19
+ /**
20
+ * Icon width
21
+ */
22
+ width?: number;
23
+ }, {}, "">;
24
+ type Props = {
25
+ /**
26
+ * Icon color
27
+ */
28
+ color?: string;
29
+ /**
30
+ * Icon height
31
+ */
32
+ height?: number;
33
+ /**
34
+ * Icon StrokeWidth
35
+ */
36
+ strokeWidth?: number;
37
+ /**
38
+ * Icon width
39
+ */
40
+ width?: number;
41
+ };
@@ -0,0 +1,27 @@
1
+ <script>
2
+ /**
3
+ * @typedef {Object} Props
4
+ * @property {string} [color=""] Icon color
5
+ * @property {number} [height=24] Icon height
6
+ * @property {number} [strokeWidth=24] Icon StrokeWidth
7
+ * @property {number} [width=24] Icon width
8
+ */
9
+
10
+ /** @type {Props} */
11
+ let { color, height, width, strokeWidth, ...rest } = $props();
12
+ </script>
13
+
14
+ <svg
15
+ {height}
16
+ {width}
17
+ viewBox="0 0 24 24"
18
+ fill="none"
19
+ xmlns="http://www.w3.org/2000/svg"
20
+ {...rest}>
21
+ <path
22
+ d="M9 14H13M9 17H16M5.875 2H18.125C18.6082 2 19 2.44772 19 3V21C19 21.5523 18.6082 22 18.125 22H5.875C5.39175 22 5 21.5523 5 21V3C5 2.44772 5.39175 2 5.875 2ZM9 2H12V10L10.5 8L9 10V2Z"
23
+ stroke={color}
24
+ stroke-width={strokeWidth}
25
+ stroke-linecap="round"
26
+ stroke-linejoin="round" />
27
+ </svg>
@@ -0,0 +1,41 @@
1
+ export default Offer;
2
+ type Offer = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<Props>): void;
5
+ };
6
+ declare const Offer: import("svelte").Component<{
7
+ /**
8
+ * Icon color
9
+ */
10
+ color?: string;
11
+ /**
12
+ * Icon height
13
+ */
14
+ height?: number;
15
+ /**
16
+ * Icon StrokeWidth
17
+ */
18
+ strokeWidth?: number;
19
+ /**
20
+ * Icon width
21
+ */
22
+ width?: number;
23
+ }, {}, "">;
24
+ type Props = {
25
+ /**
26
+ * Icon color
27
+ */
28
+ color?: string;
29
+ /**
30
+ * Icon height
31
+ */
32
+ height?: number;
33
+ /**
34
+ * Icon StrokeWidth
35
+ */
36
+ strokeWidth?: number;
37
+ /**
38
+ * Icon width
39
+ */
40
+ width?: number;
41
+ };
@@ -0,0 +1,27 @@
1
+ <script>
2
+ /**
3
+ * @typedef {Object} Props
4
+ * @property {string} [color=""] Icon color
5
+ * @property {number} [height=24] Icon height
6
+ * @property {number} [strokeWidth=24] Icon StrokeWidth
7
+ * @property {number} [width=24] Icon width
8
+ */
9
+
10
+ /** @type {Props} */
11
+ let { color, height, width, strokeWidth, ...rest } = $props();
12
+ </script>
13
+
14
+ <svg
15
+ {height}
16
+ {width}
17
+ viewBox="0 0 24 24"
18
+ fill="none"
19
+ xmlns="http://www.w3.org/2000/svg"
20
+ {...rest}>
21
+ <path
22
+ d="M4 7.5L7.76471 9.75M4 7.5L12 3M4 7.5V16.5M4 16.5L12 12M4 16.5L12 21M12 21V16.5M12 21L20 16.5M20 16.5L12 12M20 16.5V7.5M20 7.5L16.2353 9.75M20 7.5L12 3M12 3V12"
23
+ stroke={color}
24
+ stroke-width={strokeWidth}
25
+ stroke-linecap="round"
26
+ stroke-linejoin="round" />
27
+ </svg>
@@ -0,0 +1,41 @@
1
+ export default Resource;
2
+ type Resource = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<Props>): void;
5
+ };
6
+ declare const Resource: import("svelte").Component<{
7
+ /**
8
+ * Icon color
9
+ */
10
+ color?: string;
11
+ /**
12
+ * Icon height
13
+ */
14
+ height?: number;
15
+ /**
16
+ * Icon StrokeWidth
17
+ */
18
+ strokeWidth?: number;
19
+ /**
20
+ * Icon width
21
+ */
22
+ width?: number;
23
+ }, {}, "">;
24
+ type Props = {
25
+ /**
26
+ * Icon color
27
+ */
28
+ color?: string;
29
+ /**
30
+ * Icon height
31
+ */
32
+ height?: number;
33
+ /**
34
+ * Icon StrokeWidth
35
+ */
36
+ strokeWidth?: number;
37
+ /**
38
+ * Icon width
39
+ */
40
+ width?: number;
41
+ };
@@ -10,6 +10,13 @@ const moduleRegistry = import.meta.glob("./**/*.svelte", {
10
10
 
11
11
  const registry = {};
12
12
 
13
+ // e.g. for backwards compatibility
14
+ const synonyms = {
15
+ "checkbox-stack": "checkboxStack",
16
+ "file-pdf": "filePDF",
17
+ unlink: "connectCrossed",
18
+ };
19
+
13
20
  const addIconsToRegistry = (pathModuleRecord) => {
14
21
  const map = Object.fromEntries(
15
22
  Object.entries(pathModuleRecord).map(([path, module]) => {
@@ -28,26 +35,14 @@ const addIconsToRegistry = (pathModuleRecord) => {
28
35
  }),
29
36
  );
30
37
  Object.assign(registry, map);
31
- };
32
38
 
33
- // e.g. for backwards compatibility
34
- const synonyms = {
35
- "checkbox-stack": "checkboxStack",
36
- "file-pdf": "filePDF",
37
- unlink: "connectCrossed",
39
+ // attach synonyms to registry
40
+ Object.entries(synonyms).map(([k, v]) => {
41
+ if (registry[k]) return;
42
+ registry[k] = registry[v];
43
+ });
38
44
  };
39
45
 
40
46
  addIconsToRegistry(moduleRegistry);
41
47
 
42
- // attach synonyms to registry, with error handling for duplicates
43
- Object.entries(synonyms).map(([k, v]) => {
44
- if (registry[k]) {
45
- console.error(
46
- `skipping synonym "${k}" because it already exists in the registry`,
47
- );
48
- return;
49
- }
50
- registry[k] = registry[v];
51
- });
52
-
53
48
  export { addIconsToRegistry, registry, synonyms };
@@ -1,5 +1,5 @@
1
1
  <script>
2
- import { onMount, setContext } from "svelte";
2
+ import { setContext, untrack } from "svelte";
3
3
  import RichTextEditorToolbar from "./toolbar/RichTextEditorToolbar.svelte";
4
4
  import { richTextEditorVariants } from "./richTextEditor.variants.js";
5
5
 
@@ -42,9 +42,11 @@
42
42
  ...rest
43
43
  } = $props();
44
44
 
45
+ let DOMPurify;
45
46
  let element = $state();
46
- let htmlInputValue = $state();
47
+ /** @type {import("@tiptap/core").Editor} */
47
48
  let editor = $state.raw();
49
+ let htmlInputValue = $state();
48
50
 
49
51
  let styles = $derived(richTextEditorVariants({ hideToolbar, size }));
50
52
 
@@ -58,7 +60,7 @@
58
60
  const { TextStyle } = await import("@tiptap/extension-text-style");
59
61
  const Highlight = (await import("@tiptap/extension-highlight")).default;
60
62
  const Placeholder = (await import("@tiptap/extension-placeholder")).default;
61
- const DOMPurify = (await import("dompurify")).default;
63
+ DOMPurify = (await import("dompurify")).default;
62
64
 
63
65
  editor = new Editor({
64
66
  element: element,
@@ -86,24 +88,13 @@
86
88
  editorProps: {
87
89
  handlePaste(view, event) {
88
90
  const html = event.clipboardData.getData("text/html");
91
+ const sanitized = sanitizeContent(html);
92
+ if (!sanitized) return false;
89
93
 
90
- if (html) {
91
- const cleaned = DOMPurify.sanitize(html, {
92
- ALLOWED_TAGS: ["b", "strong", "i", "em", "u", "s", "strike", "p", "br"],
93
- ALLOWED_ATTR: [],
94
- });
95
-
96
- const normalized = cleanHTMLWhitespace(cleaned);
97
-
98
- editor.commands.insertContent(normalized);
99
-
100
- return true;
101
- }
102
-
103
- return false;
94
+ editor.commands.insertContent(sanitized);
95
+ return true;
104
96
  },
105
97
  },
106
- content,
107
98
  onUpdate: () => {
108
99
  htmlInputValue = editor.getHTML();
109
100
  oninput?.(htmlInputValue);
@@ -113,14 +104,24 @@
113
104
  editor.commands.focus("end");
114
105
  };
115
106
 
116
- onMount(() => {
117
- initEditor();
107
+ $effect(() => {
108
+ element;
109
+ placeholder;
110
+ untrack(initEditor);
118
111
 
119
112
  return () => {
120
113
  editor?.destroy();
121
114
  };
122
115
  });
123
116
 
117
+ $effect(() => {
118
+ content;
119
+ if (editor) {
120
+ const sanitized = untrack(() => sanitizeContent(content));
121
+ editor.commands.setContent(sanitized ?? "");
122
+ }
123
+ });
124
+
124
125
  const cleanHTMLWhitespace = (html) => {
125
126
  const dom = document.createElement("div");
126
127
  dom.innerHTML = html;
@@ -143,6 +144,17 @@
143
144
 
144
145
  return dom.innerHTML.trim();
145
146
  };
147
+
148
+ const sanitizeContent = (html) => {
149
+ if (typeof html !== "string" || !DOMPurify) return;
150
+
151
+ const cleaned = DOMPurify.sanitize(html, {
152
+ ALLOWED_TAGS: ["b", "strong", "i", "em", "u", "s", "strike", "p", "br"],
153
+ ALLOWED_ATTR: [],
154
+ });
155
+
156
+ return cleanHTMLWhitespace(cleaned);
157
+ };
146
158
  </script>
147
159
 
148
160
  <div class={styles.base({ class: classes.base })} {...rest}>
@@ -152,7 +164,7 @@
152
164
  </div>
153
165
  {/if}
154
166
  {#if fieldName}
155
- <input type="hidden" name={fieldName} bind:value={htmlInputValue} />
167
+ <input type="hidden" name={fieldName} value={htmlInputValue} />
156
168
  {/if}
157
169
  <div
158
170
  class={styles.field({ class: classes.field })}
@@ -7,12 +7,12 @@ const dialogVariants = tv({
7
7
  "my-4 grid max-h-[calc(100vh-32px)] w-[calc(100vw-32px)] min-w-xs grid-rows-[1fr_auto] gap-4 overflow-hidden rounded-lg bg-white px-4 py-3 leading-[1.486] shadow-sm dark:bg-neutral-800 dark:text-neutral-200",
8
8
  overlay: "fixed inset-0 z-modal-backdrop bg-black/25",
9
9
  positioner:
10
- "fixed inset-0 z-1 z-modal grid items-center justify-items-center overflow-auto",
10
+ "fixed inset-0 z-modal grid items-center justify-items-center overflow-auto",
11
11
  trigger: "cursor-pointer",
12
12
  formActions: [
13
- "[&>[data-role=dismiss]]:order-1 [&>[data-role=dismiss]]:mr-auto",
14
- "[&>[data-role=secondary]]:order-2",
15
- "[&>[data-role=cta]]:order-3",
13
+ "*:data-[role=dismiss]:order-1 *:data-[role=dismiss]:mr-auto",
14
+ "*:data-[role=secondary]:order-2",
15
+ "*:data-[role=cta]:order-3",
16
16
  ],
17
17
  },
18
18
  variants: {
@@ -9,7 +9,8 @@ const modalVariants = tv({
9
9
  "flex items-end border-b border-neutral-300 px-4 py-3 ui-title-2 dark:border-neutral-700",
10
10
  body: "h-full overflow-auto",
11
11
  overlay: "fixed inset-0 z-modal-backdrop bg-black/25",
12
- positioner: "fixed inset-0 z-modal grid items-center justify-items-center",
12
+ positioner:
13
+ "fixed inset-0 z-modal grid items-center justify-items-center overflow-auto",
13
14
  trigger: "cursor-pointer",
14
15
  },
15
16
  variants: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websline/system-components",
3
- "version": "1.3.11",
3
+ "version": "1.3.13",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },