@slopmachine/svelte 0.1.8 → 0.1.10

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.
package/package.json CHANGED
@@ -1,24 +1,17 @@
1
1
  {
2
2
  "name": "@slopmachine/svelte",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "Svelte wrapper for SlopMachine",
5
5
  "type": "module",
6
- "main": "./dist/index.js",
7
- "svelte": "./dist/index.js",
6
+ "main": "src/index.ts",
7
+ "svelte": "src/index.ts",
8
8
  "exports": {
9
9
  ".": {
10
- "types": "./dist/index.d.ts",
11
- "svelte": "./dist/index.js",
12
- "default": "./dist/index.js"
10
+ "types": "./src/index.ts",
11
+ "svelte": "./src/index.ts",
12
+ "default": "./src/index.ts"
13
13
  }
14
14
  },
15
- "files": [
16
- "dist"
17
- ],
18
- "scripts": {
19
- "build": "svelte-package -i src",
20
- "prepublishOnly": "npm run build"
21
- },
22
15
  "repository": {
23
16
  "type": "git",
24
17
  "url": "git+https://github.com/slopmachine-dev/slopmachine-sdk.git"
@@ -28,9 +21,5 @@
28
21
  },
29
22
  "peerDependencies": {
30
23
  "svelte": "^5.0.0"
31
- },
32
- "devDependencies": {
33
- "@sveltejs/package": "^2.3.2",
34
- "typescript": "^5.0.0"
35
24
  }
36
25
  }
@@ -1,8 +1,10 @@
1
1
  <script lang="ts">
2
2
  import { buildImageUrl, type SlopImageOptions } from "@slopmachine/core";
3
+ import type { Snippet } from "svelte";
3
4
 
4
5
  interface Props extends SlopImageOptions {
5
6
  class?: string;
7
+ loader?: Snippet;
6
8
  }
7
9
 
8
10
  let {
@@ -14,6 +16,7 @@
14
16
  variables = {},
15
17
  baseUrl = undefined,
16
18
  class: className = "",
19
+ loader,
17
20
  ...restProps
18
21
  }: Props = $props();
19
22
 
@@ -98,25 +101,36 @@
98
101
  style="aspect-ratio: {aspectRatio.replace(':', '/')};"
99
102
  >
100
103
  {#if isLoading}
101
- <div class="loading-overlay">
102
- <div class="spinner-container">
103
- <svg
104
- class="spinner"
105
- xmlns="http://www.w3.org/2000/svg"
106
- fill="none"
107
- viewBox="0 0 24 24"
108
- >
109
- <circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"
110
- ></circle>
111
- <path
112
- fill="currentColor"
113
- d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
114
- ></path>
115
- </svg>
116
- <span>Loading...</span>
104
+ {#if loader}
105
+ <div class="custom-loader-wrapper">
106
+ {@render loader()}
117
107
  </div>
118
- </div>
119
- <div class="shimmer-effect"></div>
108
+ {:else}
109
+ <div class="loading-overlay">
110
+ <div class="spinner-container">
111
+ <svg
112
+ class="spinner"
113
+ xmlns="http://www.w3.org/2000/svg"
114
+ fill="none"
115
+ viewBox="0 0 24 24"
116
+ >
117
+ <circle
118
+ cx="12"
119
+ cy="12"
120
+ r="10"
121
+ stroke="currentColor"
122
+ stroke-width="4"
123
+ ></circle>
124
+ <path
125
+ fill="currentColor"
126
+ d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
127
+ ></path>
128
+ </svg>
129
+ <span>Loading...</span>
130
+ </div>
131
+ </div>
132
+ <div class="shimmer-effect"></div>
133
+ {/if}
120
134
  {/if}
121
135
 
122
136
  <img
@@ -138,7 +152,8 @@
138
152
  height: 100%;
139
153
  }
140
154
 
141
- .loading-overlay {
155
+ .loading-overlay,
156
+ .custom-loader-wrapper {
142
157
  position: absolute;
143
158
  top: 0;
144
159
  left: 0;
@@ -148,10 +163,13 @@
148
163
  display: flex;
149
164
  align-items: center;
150
165
  justify-content: center;
151
- background-color: var(--muted, #f3f4f6);
152
166
  transition: opacity 300ms ease-in-out;
153
167
  }
154
168
 
169
+ .loading-overlay {
170
+ background-color: var(--muted, #f3f4f6);
171
+ }
172
+
155
173
  .spinner-container {
156
174
  display: flex;
157
175
  flex-direction: column;
package/tsconfig.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "useDefineForClassFields": true,
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "strict": true,
8
+ "jsx": "preserve",
9
+ "resolveJsonModule": true,
10
+ "isolatedModules": true,
11
+ "esModuleInterop": true,
12
+ "lib": ["ESNext", "DOM", "DOM.Iterable"],
13
+ "types": ["svelte"],
14
+ "skipLibCheck": true,
15
+ "noEmit": true,
16
+ "composite": true,
17
+ "declaration": true,
18
+ "declarationMap": true
19
+ },
20
+ "include": ["src/**/*.ts", "src/**/*.svelte"]
21
+ }
@@ -1,8 +0,0 @@
1
- import { type SlopImageOptions } from "@slopmachine/core";
2
- interface Props extends SlopImageOptions {
3
- class?: string;
4
- }
5
- declare const SlopImage: import("svelte").Component<Props, {}, "">;
6
- type SlopImage = ReturnType<typeof SlopImage>;
7
- export default SlopImage;
8
- //# sourceMappingURL=SlopImage.svelte.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SlopImage.svelte.d.ts","sourceRoot":"","sources":["../src/SlopImage.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGvE,UAAU,KAAM,SAAQ,gBAAgB;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAkHH,QAAA,MAAM,SAAS,2CAAwC,CAAC;AACxD,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAC9C,eAAe,SAAS,CAAC"}
package/dist/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export { default as SlopImage } from "./SlopImage.svelte";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,oBAAoB,CAAC"}
File without changes
File without changes