@websline/system-components 1.4.7 → 1.4.8

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.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -11,16 +11,16 @@
11
11
  let { color, height, width, strokeWidth, ...rest } = $props();
12
12
  </script>
13
13
 
14
- <svg
15
- {height}
14
+ <svg
15
+ {height}
16
16
  {width}
17
- viewBox="0 0 20 20"
18
- fill="none"
19
- xmlns="http://www.w3.org/2000/svg"
20
- {...rest}>
21
- <path
22
- d="M7.77843 2.5H15.0512L10.6067 7.75H16.6673L6.97035 17.5L8.99055 10.375H3.33398L7.77843 2.5Z"
23
- stroke={color}
24
- stroke-width={strokeWidth}
25
- stroke-linejoin="round"/>
26
- </svg>
17
+ viewBox="0 0 20 20"
18
+ fill="none"
19
+ xmlns="http://www.w3.org/2000/svg"
20
+ {...rest}>
21
+ <path
22
+ d="M7.77843 2.5H15.0512L10.6067 7.75H16.6673L6.97035 17.5L8.99055 10.375H3.33398L7.77843 2.5Z"
23
+ stroke={color}
24
+ stroke-width={strokeWidth}
25
+ stroke-linejoin="round" />
26
+ </svg>
@@ -8,8 +8,10 @@
8
8
  content = "",
9
9
  fieldName = "",
10
10
  hideToolbar = false,
11
+ initialFocus = true,
11
12
  oninput,
12
13
  placeholder = "",
14
+ readonly = false,
13
15
  size = "medium",
14
16
  toolbarConfig = {
15
17
  bold: {
@@ -48,7 +50,7 @@
48
50
  let htmlInputValue = $state();
49
51
  let isContentPropUpdate = false;
50
52
 
51
- let styles = $derived(richTextEditorVariants({ hideToolbar, size }));
53
+ let styles = $derived(richTextEditorVariants({ hideToolbar, readonly, size }));
52
54
 
53
55
  setContext("richt-text-editor", () => editor);
54
56
 
@@ -132,6 +134,7 @@
132
134
  });
133
135
 
134
136
  editor = new Editor({
137
+ editable: !readonly,
135
138
  element: element,
136
139
  extensions: [
137
140
  StarterKit.configure({
@@ -183,7 +186,7 @@
183
186
  },
184
187
  });
185
188
 
186
- editor.commands.focus("end");
189
+ !readonly && initialFocus && editor.commands.focus("end");
187
190
  };
188
191
 
189
192
  $effect(() => {
@@ -8,8 +8,10 @@ declare const RichTextEditor: import("svelte").Component<{
8
8
  content?: string;
9
9
  fieldName?: string;
10
10
  hideToolbar?: boolean;
11
+ initialFocus?: boolean;
11
12
  oninput: any;
12
13
  placeholder?: string;
14
+ readonly?: boolean;
13
15
  size?: string;
14
16
  toolbarConfig?: Record<string, any>;
15
17
  } & Record<string, any>, {}, "">;
@@ -18,8 +20,10 @@ type $$ComponentProps = {
18
20
  content?: string;
19
21
  fieldName?: string;
20
22
  hideToolbar?: boolean;
23
+ initialFocus?: boolean;
21
24
  oninput: any;
22
25
  placeholder?: string;
26
+ readonly?: boolean;
23
27
  size?: string;
24
28
  toolbarConfig?: Record<string, any>;
25
29
  } & Record<string, any>;
@@ -4,6 +4,12 @@ export const richTextEditorVariants: import("tailwind-variants").TVReturnType<{
4
4
  field: string;
5
5
  };
6
6
  };
7
+ readonly: {
8
+ true: {
9
+ base: string;
10
+ toolbar: string;
11
+ };
12
+ };
7
13
  size: {
8
14
  small: {
9
15
  field: string;
@@ -25,6 +31,12 @@ export const richTextEditorVariants: import("tailwind-variants").TVReturnType<{
25
31
  field: string;
26
32
  };
27
33
  };
34
+ readonly: {
35
+ true: {
36
+ base: string;
37
+ toolbar: string;
38
+ };
39
+ };
28
40
  size: {
29
41
  small: {
30
42
  field: string;
@@ -46,6 +58,12 @@ export const richTextEditorVariants: import("tailwind-variants").TVReturnType<{
46
58
  field: string;
47
59
  };
48
60
  };
61
+ readonly: {
62
+ true: {
63
+ base: string;
64
+ toolbar: string;
65
+ };
66
+ };
49
67
  size: {
50
68
  small: {
51
69
  field: string;
@@ -4,10 +4,10 @@ const richTextEditorVariants = tv({
4
4
  slots: {
5
5
  base: "body-small text-neutral-800 dark:text-white",
6
6
  toolbar:
7
- "pointer flex gap-0.5 rounded-t-sm border border-b-0 border-neutral-300 px-5 py-2 dark:border-neutral-700",
7
+ "pointer flex gap-0.5 rounded-t-lg border border-b-0 border-neutral-300 px-5 py-2 dark:border-neutral-700",
8
8
  field: [
9
9
  "[&>div]:transition-[border] [&>div]:duration-300",
10
- "[&>div]:rounded-b-sm [&>div]:border [&>div]:border-neutral-300 [&>div]:outline-none dark:[&>div]:border-neutral-700",
10
+ "[&>div]:rounded-b-lg [&>div]:border [&>div]:border-neutral-300 [&>div]:outline-none dark:[&>div]:border-neutral-700",
11
11
  "[&>div]:h-full [&>div]:overflow-auto [&>div]:p-5",
12
12
  "[&>div>p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]",
13
13
  "[&>div>p.is-editor-empty:first-child::before]:float-left",
@@ -22,7 +22,13 @@ const richTextEditorVariants = tv({
22
22
  variants: {
23
23
  hideToolbar: {
24
24
  true: {
25
- field: "[&>div]:rounded-t-sm",
25
+ field: "[&>div]:rounded-t-lg",
26
+ },
27
+ },
28
+ readonly: {
29
+ true: {
30
+ base: "cursor-not-allowed",
31
+ toolbar: "pointer-events-none *:opacity-40",
26
32
  },
27
33
  },
28
34
  size: {
package/package.json CHANGED
@@ -1,109 +1,100 @@
1
1
  {
2
- "name": "@websline/system-components",
3
- "version": "1.4.7",
4
- "publishConfig": {
5
- "access": "public"
6
- },
7
- "repository": {
8
- "type": "git",
9
- "url": "https://github.com/Websline/websline.system-components.git"
10
- },
11
- "scripts": {
12
- "dev": "vite dev",
13
- "build": "vite build",
14
- "prepare": "node scripts/generate-barrels.js && svelte-kit sync || echo ''",
15
- "prepack": "pnpm prepare && svelte-package && publint",
16
- "format": "prettier --write .",
17
- "lint": "prettier --check . && eslint .",
18
- "test:unit": "vitest",
19
- "test": "npm run test:unit -- --run",
20
- "storybook": "storybook dev -p 6006",
21
- "build-storybook": "storybook build"
22
- },
23
- "files": [
24
- "dist",
25
- "!dist/**/*.test.*",
26
- "!dist/**/*.spec.*"
27
- ],
28
- "sideEffects": [
29
- "**/*.css"
30
- ],
31
- "svelte": "./dist/index.js",
32
- "types": "./dist/index.d.ts",
33
- "type": "module",
34
- "exports": {
35
- ".": {
36
- "types": "./dist/index.d.ts",
37
- "svelte": "./dist/index.js",
38
- "style": "./dist/index.css"
39
- },
40
- "./assets/*": "./dist/assets/*",
41
- "./components/*": "./dist/components/*",
42
- "./utils/*": "./dist/utils/*",
43
- "./webfonts.css": {
44
- "style": "./dist/webfonts.css"
45
- }
46
- },
47
- "dependencies": {
48
- "@tiptap/core": "^3.22.2",
49
- "@tiptap/extension-color": "^3.22.2",
50
- "@tiptap/extension-highlight": "^3.22.2",
51
- "@tiptap/extension-link": "^3.22.2",
52
- "@tiptap/extension-placeholder": "^3.22.2",
53
- "@tiptap/extension-text-align": "^3.22.2",
54
- "@tiptap/extension-text-style": "^3.22.2",
55
- "@tiptap/pm": "^3.22.2",
56
- "@tiptap/starter-kit": "^3.22.2",
57
- "bits-ui": "^2.17.2",
58
- "dompurify": "^3.3.3",
59
- "tailwind-variants": "^3.2.2"
60
- },
61
- "peerDependencies": {
62
- "svelte": "^5.38.7"
63
- },
64
- "devDependencies": {
65
- "@eslint/compat": "^2.0.4",
66
- "@eslint/js": "^10.0.1",
67
- "@storybook/addon-a11y": "^10.3.4",
68
- "@storybook/addon-docs": "^10.3.4",
69
- "@storybook/addon-svelte-csf": "^5.1.2",
70
- "@storybook/sveltekit": "^10.3.4",
71
- "@sveltejs/adapter-auto": "^7.0.1",
72
- "@sveltejs/kit": "^2.56.1",
73
- "@sveltejs/package": "^2.5.7",
74
- "@sveltejs/vite-plugin-svelte": "^7.0.0",
75
- "@tailwindcss/forms": "^0.5.11",
76
- "@tailwindcss/typography": "^0.5.19",
77
- "@tailwindcss/vite": "^4.2.2",
78
- "@types/node": "^25.5.2",
79
- "@vitest/browser": "^4.1.3",
80
- "eslint": "^10.2.0",
81
- "eslint-config-prettier": "^10.1.8",
82
- "eslint-plugin-storybook": "^10.3.4",
83
- "eslint-plugin-svelte": "^3.17.0",
84
- "globals": "^17.4.0",
85
- "playwright": "^1.59.1",
86
- "postcss-url": "^10.1.3",
87
- "prettier": "^3.8.1",
88
- "prettier-plugin-svelte": "^3.5.1",
89
- "prettier-plugin-tailwindcss": "^0.7.2",
90
- "publint": "^0.3.18",
91
- "storybook": "^10.3.4",
92
- "svelte": "^5.55.1",
93
- "tailwindcss": "^4.2.2",
94
- "typescript": "^5.9.3",
95
- "vite": "^8.0.6",
96
- "vitest": "^4.1.3",
97
- "vitest-browser-svelte": "^2.1.0"
98
- },
99
- "keywords": [
100
- "svelte"
101
- ],
102
- "pnpm": {
103
- "onlyBuiltDependencies": [
104
- "@tailwindcss/oxide",
105
- "esbuild"
106
- ]
107
- },
108
- "packageManager": "pnpm@10.20.0"
109
- }
2
+ "name": "@websline/system-components",
3
+ "version": "1.4.8",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/Websline/websline.system-components.git"
10
+ },
11
+ "files": [
12
+ "dist",
13
+ "!dist/**/*.test.*",
14
+ "!dist/**/*.spec.*"
15
+ ],
16
+ "sideEffects": [
17
+ "**/*.css"
18
+ ],
19
+ "svelte": "./dist/index.js",
20
+ "types": "./dist/index.d.ts",
21
+ "type": "module",
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "svelte": "./dist/index.js",
26
+ "style": "./dist/index.css"
27
+ },
28
+ "./assets/*": "./dist/assets/*",
29
+ "./components/*": "./dist/components/*",
30
+ "./utils/*": "./dist/utils/*",
31
+ "./webfonts.css": {
32
+ "style": "./dist/webfonts.css"
33
+ }
34
+ },
35
+ "dependencies": {
36
+ "@tiptap/core": "^3.22.2",
37
+ "@tiptap/extension-color": "^3.22.2",
38
+ "@tiptap/extension-highlight": "^3.22.2",
39
+ "@tiptap/extension-link": "^3.22.2",
40
+ "@tiptap/extension-placeholder": "^3.22.2",
41
+ "@tiptap/extension-text-align": "^3.22.2",
42
+ "@tiptap/extension-text-style": "^3.22.2",
43
+ "@tiptap/pm": "^3.22.2",
44
+ "@tiptap/starter-kit": "^3.22.2",
45
+ "bits-ui": "^2.17.2",
46
+ "dompurify": "^3.3.3",
47
+ "tailwind-variants": "^3.2.2"
48
+ },
49
+ "peerDependencies": {
50
+ "svelte": "^5.38.7"
51
+ },
52
+ "devDependencies": {
53
+ "@eslint/compat": "^2.0.4",
54
+ "@eslint/js": "^10.0.1",
55
+ "@storybook/addon-a11y": "^10.3.4",
56
+ "@storybook/addon-docs": "^10.3.4",
57
+ "@storybook/addon-svelte-csf": "^5.1.2",
58
+ "@storybook/sveltekit": "^10.3.4",
59
+ "@sveltejs/adapter-auto": "^7.0.1",
60
+ "@sveltejs/kit": "^2.56.1",
61
+ "@sveltejs/package": "^2.5.7",
62
+ "@sveltejs/vite-plugin-svelte": "^7.0.0",
63
+ "@tailwindcss/forms": "^0.5.11",
64
+ "@tailwindcss/typography": "^0.5.19",
65
+ "@tailwindcss/vite": "^4.2.2",
66
+ "@types/node": "^25.5.2",
67
+ "@vitest/browser": "^4.1.3",
68
+ "eslint": "^10.2.0",
69
+ "eslint-config-prettier": "^10.1.8",
70
+ "eslint-plugin-storybook": "^10.3.4",
71
+ "eslint-plugin-svelte": "^3.17.0",
72
+ "globals": "^17.4.0",
73
+ "playwright": "^1.59.1",
74
+ "postcss-url": "^10.1.3",
75
+ "prettier": "^3.8.1",
76
+ "prettier-plugin-svelte": "^3.5.1",
77
+ "prettier-plugin-tailwindcss": "^0.7.2",
78
+ "publint": "^0.3.18",
79
+ "storybook": "^10.3.4",
80
+ "svelte": "^5.55.1",
81
+ "tailwindcss": "^4.2.2",
82
+ "typescript": "^5.9.3",
83
+ "vite": "^8.0.6",
84
+ "vitest": "^4.1.3",
85
+ "vitest-browser-svelte": "^2.1.0"
86
+ },
87
+ "keywords": [
88
+ "svelte"
89
+ ],
90
+ "scripts": {
91
+ "dev": "vite dev",
92
+ "build": "vite build",
93
+ "format": "prettier --write .",
94
+ "lint": "prettier --check . && eslint .",
95
+ "test:unit": "vitest",
96
+ "test": "npm run test:unit -- --run",
97
+ "storybook": "storybook dev -p 6006",
98
+ "build-storybook": "storybook build"
99
+ }
100
+ }