@papu1337/builder 0.0.3 → 0.0.5
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/README.md +1 -65
- package/dist/elements/accordion/accordionElement.svelte +101 -0
- package/dist/elements/accordion/accordionElement.svelte.d.ts +7 -0
- package/dist/elements/accordion/settings.d.ts +17 -0
- package/dist/elements/accordion/settings.js +54 -0
- package/dist/elements/badge/badgeElement.svelte +4 -3
- package/dist/elements/badge/settings.d.ts +3 -2
- package/dist/elements/badge/settings.js +20 -30
- package/dist/elements/banner/bannerElement.svelte +38 -10
- package/dist/elements/banner/settings.d.ts +5 -3
- package/dist/elements/banner/settings.js +15 -10
- package/dist/elements/button/buttonElement.svelte +7 -3
- package/dist/elements/button/settings.d.ts +1 -0
- package/dist/elements/button/settings.js +10 -6
- package/dist/elements/ctaCard/ctaCardElement.svelte +132 -0
- package/dist/elements/ctaCard/ctaCardElement.svelte.d.ts +7 -0
- package/dist/elements/ctaCard/settings.d.ts +22 -0
- package/dist/elements/ctaCard/settings.js +64 -0
- package/dist/elements/text/settings.d.ts +11 -6
- package/dist/elements/text/settings.js +48 -4
- package/dist/elements/text/textElement.svelte +7 -2
- package/dist/renderer/registry.js +8 -14
- package/dist/renderer/renderer.vanilla.es.js +1172 -1354
- package/dist/renderer/renderer.vanilla.umd.js +27 -19
- package/dist/settings/base.svelte.js +3 -5
- package/dist/settings/components/ColorSettings.svelte +6 -6
- package/dist/settings/components/ListSettings.svelte +12 -12
- package/dist/settings/components/NumberSettings.svelte +6 -6
- package/dist/settings/components/SelectSettings.svelte +6 -6
- package/dist/settings/components/SettingsGroup.svelte +3 -3
- package/dist/settings/components/TextSettings.svelte +53 -2
- package/dist/settings/components/TranslatableSettings.svelte +15 -15
- package/dist/settings/components/UploadSettings.svelte +6 -6
- package/package.json +4 -4
- package/dist/elements/auth/authElement.svelte +0 -115
- package/dist/elements/auth/authElement.svelte.d.ts +0 -7
- package/dist/elements/auth/settings.d.ts +0 -25
- package/dist/elements/auth/settings.js +0 -63
- package/dist/elements/cards/cardsElement.svelte +0 -136
- package/dist/elements/cards/cardsElement.svelte.d.ts +0 -7
- package/dist/elements/cards/settings.d.ts +0 -14
- package/dist/elements/cards/settings.js +0 -52
- package/dist/elements/divider/dividerElement.svelte +0 -34
- package/dist/elements/divider/dividerElement.svelte.d.ts +0 -7
- package/dist/elements/divider/settings.d.ts +0 -7
- package/dist/elements/divider/settings.js +0 -15
- package/dist/elements/products/productsElement.svelte +0 -283
- package/dist/elements/products/productsElement.svelte.d.ts +0 -7
- package/dist/elements/products/settings.d.ts +0 -16
- package/dist/elements/products/settings.js +0 -56
- package/dist/elements/terms/settings.d.ts +0 -11
- package/dist/elements/terms/settings.js +0 -39
- package/dist/elements/terms/termsElement.svelte +0 -124
- package/dist/elements/terms/termsElement.svelte.d.ts +0 -7
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { ProductsSettingsMap } from './settings';
|
|
3
|
-
|
|
4
|
-
let { settings }: { settings: ProductsSettingsMap } = $props();
|
|
5
|
-
|
|
6
|
-
interface Product {
|
|
7
|
-
_id: string;
|
|
8
|
-
title: string;
|
|
9
|
-
description: string;
|
|
10
|
-
thumbnail: string;
|
|
11
|
-
rating: number;
|
|
12
|
-
stock: number;
|
|
13
|
-
brand: string;
|
|
14
|
-
price: {
|
|
15
|
-
current: number;
|
|
16
|
-
currency: string;
|
|
17
|
-
beforeDiscount: number;
|
|
18
|
-
discountPercentage: number;
|
|
19
|
-
};
|
|
20
|
-
category: {
|
|
21
|
-
id: string;
|
|
22
|
-
name: string;
|
|
23
|
-
image: string;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
let products = $state<Product[]>([]);
|
|
28
|
-
let loading = $state(false);
|
|
29
|
-
let error = $state('');
|
|
30
|
-
|
|
31
|
-
let lastUrl = $state('');
|
|
32
|
-
|
|
33
|
-
$effect(() => {
|
|
34
|
-
const url = settings.apiUrl;
|
|
35
|
-
if (!url || url === lastUrl) return;
|
|
36
|
-
lastUrl = url;
|
|
37
|
-
fetchProducts(url);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
async function fetchProducts(url: string) {
|
|
41
|
-
loading = true;
|
|
42
|
-
error = '';
|
|
43
|
-
try {
|
|
44
|
-
const res = await fetch(url);
|
|
45
|
-
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
46
|
-
const data = await res.json();
|
|
47
|
-
products = data.products ?? data.data ?? (Array.isArray(data) ? data : []);
|
|
48
|
-
} catch (e) {
|
|
49
|
-
error = e instanceof Error ? e.message : 'Failed to fetch';
|
|
50
|
-
products = [];
|
|
51
|
-
} finally {
|
|
52
|
-
loading = false;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function formatCurrency(amount: number, currency: string) {
|
|
57
|
-
return `${currency === 'USD' ? '$' : currency} ${amount}`;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function renderStars(rating: number): string {
|
|
61
|
-
const full = Math.floor(rating);
|
|
62
|
-
const half = rating - full >= 0.5 ? 1 : 0;
|
|
63
|
-
const empty = 5 - full - half;
|
|
64
|
-
return '★'.repeat(full) + (half ? '½' : '') + '☆'.repeat(empty);
|
|
65
|
-
}
|
|
66
|
-
</script>
|
|
67
|
-
|
|
68
|
-
<div class="products-wrapper" style="margin-top: {settings.marginTop}px;">
|
|
69
|
-
{#if !settings.apiUrl}
|
|
70
|
-
<div class="placeholder">
|
|
71
|
-
<span class="placeholder-icon">🛒</span>
|
|
72
|
-
<span class="placeholder-text">Enter an API URL in settings to load products</span>
|
|
73
|
-
</div>
|
|
74
|
-
{:else if loading}
|
|
75
|
-
<div class="placeholder">
|
|
76
|
-
<span class="placeholder-text">Loading products...</span>
|
|
77
|
-
</div>
|
|
78
|
-
{:else if error}
|
|
79
|
-
<div class="placeholder error">
|
|
80
|
-
<span class="placeholder-text">Error: {error}</span>
|
|
81
|
-
</div>
|
|
82
|
-
{:else if products.length === 0}
|
|
83
|
-
<div class="placeholder">
|
|
84
|
-
<span class="placeholder-text">No products found</span>
|
|
85
|
-
</div>
|
|
86
|
-
{:else}
|
|
87
|
-
<div class="products-grid" style="grid-template-columns: repeat({settings.columns}, 1fr);">
|
|
88
|
-
{#each products as product (product._id)}
|
|
89
|
-
<div
|
|
90
|
-
class="product-card"
|
|
91
|
-
style="background: {settings.cardBackground}; border: 1px solid {settings.cardBorder};"
|
|
92
|
-
>
|
|
93
|
-
<div class="product-image-wrap">
|
|
94
|
-
<img src={product.thumbnail} alt={product.title} class="product-image" />
|
|
95
|
-
{#if product.price.discountPercentage > 0}
|
|
96
|
-
<span
|
|
97
|
-
class="discount-badge"
|
|
98
|
-
style="background: {settings.discountBadgeBackground}; color: {settings.discountBadgeColor};"
|
|
99
|
-
>
|
|
100
|
-
-{product.price.discountPercentage}%
|
|
101
|
-
</span>
|
|
102
|
-
{/if}
|
|
103
|
-
</div>
|
|
104
|
-
|
|
105
|
-
<div class="product-info">
|
|
106
|
-
<span class="product-brand">{product.brand}</span>
|
|
107
|
-
<h4 class="product-title" style="color: {settings.titleColor};">
|
|
108
|
-
{product.title}
|
|
109
|
-
</h4>
|
|
110
|
-
<p class="product-desc" style="color: {settings.descriptionColor};">
|
|
111
|
-
{product.description.length > 80
|
|
112
|
-
? product.description.slice(0, 80) + '...'
|
|
113
|
-
: product.description}
|
|
114
|
-
</p>
|
|
115
|
-
|
|
116
|
-
<div class="product-rating" style="color: {settings.ratingColor};">
|
|
117
|
-
{renderStars(product.rating)}
|
|
118
|
-
<span class="rating-num">{product.rating.toFixed(1)}</span>
|
|
119
|
-
</div>
|
|
120
|
-
|
|
121
|
-
<div class="product-price">
|
|
122
|
-
<span class="current-price" style="color: {settings.priceColor};">
|
|
123
|
-
{formatCurrency(product.price.current, product.price.currency)}
|
|
124
|
-
</span>
|
|
125
|
-
{#if product.price.beforeDiscount > product.price.current}
|
|
126
|
-
<span class="old-price" style="color: {settings.oldPriceColor};">
|
|
127
|
-
{formatCurrency(product.price.beforeDiscount, product.price.currency)}
|
|
128
|
-
</span>
|
|
129
|
-
{/if}
|
|
130
|
-
</div>
|
|
131
|
-
</div>
|
|
132
|
-
</div>
|
|
133
|
-
{/each}
|
|
134
|
-
</div>
|
|
135
|
-
{/if}
|
|
136
|
-
</div>
|
|
137
|
-
|
|
138
|
-
<style>
|
|
139
|
-
.products-wrapper {
|
|
140
|
-
max-width: 750px;
|
|
141
|
-
width: 100%;
|
|
142
|
-
margin: 0 auto;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.placeholder {
|
|
146
|
-
display: flex;
|
|
147
|
-
flex-direction: column;
|
|
148
|
-
align-items: center;
|
|
149
|
-
justify-content: center;
|
|
150
|
-
gap: 10px;
|
|
151
|
-
padding: 48px 24px;
|
|
152
|
-
border: 1.5px dashed rgba(255, 255, 255, 0.12);
|
|
153
|
-
border-radius: 8px;
|
|
154
|
-
background: rgba(255, 255, 255, 0.03);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.placeholder.error {
|
|
158
|
-
border-color: rgba(239, 68, 68, 0.3);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
.placeholder-icon {
|
|
162
|
-
font-size: 2rem;
|
|
163
|
-
opacity: 0.3;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.placeholder-text {
|
|
167
|
-
font-size: 0.8rem;
|
|
168
|
-
color: rgba(255, 255, 255, 0.3);
|
|
169
|
-
text-align: center;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
.products-grid {
|
|
173
|
-
display: grid;
|
|
174
|
-
gap: 14px;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
.product-card {
|
|
178
|
-
border-radius: 10px;
|
|
179
|
-
overflow: hidden;
|
|
180
|
-
display: flex;
|
|
181
|
-
flex-direction: column;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
.product-image-wrap {
|
|
185
|
-
position: relative;
|
|
186
|
-
width: 100%;
|
|
187
|
-
aspect-ratio: 4/3;
|
|
188
|
-
overflow: hidden;
|
|
189
|
-
background: rgba(0, 0, 0, 0.2);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
.product-image {
|
|
193
|
-
width: 100%;
|
|
194
|
-
height: 100%;
|
|
195
|
-
object-fit: cover;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.discount-badge {
|
|
199
|
-
position: absolute;
|
|
200
|
-
top: 8px;
|
|
201
|
-
right: 8px;
|
|
202
|
-
padding: 3px 8px;
|
|
203
|
-
border-radius: 6px;
|
|
204
|
-
font-size: 0.7rem;
|
|
205
|
-
font-weight: 700;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
.product-info {
|
|
209
|
-
padding: 14px;
|
|
210
|
-
display: flex;
|
|
211
|
-
flex-direction: column;
|
|
212
|
-
gap: 6px;
|
|
213
|
-
flex: 1;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
.product-brand {
|
|
217
|
-
font-size: 0.65rem;
|
|
218
|
-
text-transform: uppercase;
|
|
219
|
-
letter-spacing: 0.08em;
|
|
220
|
-
color: rgba(255, 255, 255, 0.35);
|
|
221
|
-
font-weight: 600;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
.product-title {
|
|
225
|
-
margin: 0;
|
|
226
|
-
font-size: 0.85rem;
|
|
227
|
-
font-weight: 600;
|
|
228
|
-
line-height: 1.3;
|
|
229
|
-
display: -webkit-box;
|
|
230
|
-
-webkit-line-clamp: 2;
|
|
231
|
-
-webkit-box-orient: vertical;
|
|
232
|
-
overflow: hidden;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
.product-desc {
|
|
236
|
-
margin: 0;
|
|
237
|
-
font-size: 0.75rem;
|
|
238
|
-
line-height: 1.4;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
.product-rating {
|
|
242
|
-
font-size: 0.75rem;
|
|
243
|
-
display: flex;
|
|
244
|
-
align-items: center;
|
|
245
|
-
gap: 4px;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
.rating-num {
|
|
249
|
-
font-size: 0.7rem;
|
|
250
|
-
opacity: 0.6;
|
|
251
|
-
color: rgba(255, 255, 255, 0.5);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
.product-price {
|
|
255
|
-
display: flex;
|
|
256
|
-
align-items: baseline;
|
|
257
|
-
gap: 8px;
|
|
258
|
-
margin-top: auto;
|
|
259
|
-
padding-top: 6px;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
.current-price {
|
|
263
|
-
font-size: 1rem;
|
|
264
|
-
font-weight: 700;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
.old-price {
|
|
268
|
-
font-size: 0.8rem;
|
|
269
|
-
text-decoration: line-through;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
@media (max-width: 640px) {
|
|
273
|
-
.products-grid {
|
|
274
|
-
grid-template-columns: repeat(2, 1fr) !important;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
@media (max-width: 400px) {
|
|
279
|
-
.products-grid {
|
|
280
|
-
grid-template-columns: 1fr !important;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
</style>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ProductsSettingsMap } from './settings';
|
|
2
|
-
type $$ComponentProps = {
|
|
3
|
-
settings: ProductsSettingsMap;
|
|
4
|
-
};
|
|
5
|
-
declare const ProductsElement: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
-
type ProductsElement = ReturnType<typeof ProductsElement>;
|
|
7
|
-
export default ProductsElement;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ColorSetting, NumberSetting, TextSetting, Settings, type InferSettingsMapType } from '../../settings';
|
|
2
|
-
export declare const productsSettings: Settings<{
|
|
3
|
-
marginTop: NumberSetting;
|
|
4
|
-
apiUrl: TextSetting;
|
|
5
|
-
columns: NumberSetting;
|
|
6
|
-
cardBackground: ColorSetting;
|
|
7
|
-
cardBorder: ColorSetting;
|
|
8
|
-
titleColor: ColorSetting;
|
|
9
|
-
descriptionColor: ColorSetting;
|
|
10
|
-
priceColor: ColorSetting;
|
|
11
|
-
oldPriceColor: ColorSetting;
|
|
12
|
-
discountBadgeBackground: ColorSetting;
|
|
13
|
-
discountBadgeColor: ColorSetting;
|
|
14
|
-
ratingColor: ColorSetting;
|
|
15
|
-
}>;
|
|
16
|
-
export type ProductsSettingsMap = InferSettingsMapType<typeof productsSettings>;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { ColorSetting, NumberSetting, TextSetting, Settings } from '../../settings';
|
|
2
|
-
export const productsSettings = new Settings('Products', {
|
|
3
|
-
marginTop: new NumberSetting({
|
|
4
|
-
title: 'Margin Top',
|
|
5
|
-
defaultValue: 0
|
|
6
|
-
}),
|
|
7
|
-
apiUrl: new TextSetting({
|
|
8
|
-
title: 'API URL',
|
|
9
|
-
defaultValue: ''
|
|
10
|
-
}),
|
|
11
|
-
columns: new NumberSetting({
|
|
12
|
-
title: 'Columns',
|
|
13
|
-
defaultValue: 3,
|
|
14
|
-
extra: {
|
|
15
|
-
min: 1,
|
|
16
|
-
max: 4,
|
|
17
|
-
step: 1
|
|
18
|
-
}
|
|
19
|
-
}),
|
|
20
|
-
cardBackground: new ColorSetting({
|
|
21
|
-
title: 'Card Background',
|
|
22
|
-
defaultValue: '#162D3F'
|
|
23
|
-
}),
|
|
24
|
-
cardBorder: new ColorSetting({
|
|
25
|
-
title: 'Card Border',
|
|
26
|
-
defaultValue: 'rgba(177, 202, 223, 0.1)'
|
|
27
|
-
}),
|
|
28
|
-
titleColor: new ColorSetting({
|
|
29
|
-
title: 'Title Color',
|
|
30
|
-
defaultValue: '#ffffff'
|
|
31
|
-
}),
|
|
32
|
-
descriptionColor: new ColorSetting({
|
|
33
|
-
title: 'Description Color',
|
|
34
|
-
defaultValue: 'rgba(255, 255, 255, 0.6)'
|
|
35
|
-
}),
|
|
36
|
-
priceColor: new ColorSetting({
|
|
37
|
-
title: 'Price Color',
|
|
38
|
-
defaultValue: '#4ade80'
|
|
39
|
-
}),
|
|
40
|
-
oldPriceColor: new ColorSetting({
|
|
41
|
-
title: 'Old Price Color',
|
|
42
|
-
defaultValue: 'rgba(255, 255, 255, 0.35)'
|
|
43
|
-
}),
|
|
44
|
-
discountBadgeBackground: new ColorSetting({
|
|
45
|
-
title: 'Discount Badge Background',
|
|
46
|
-
defaultValue: '#ef4444'
|
|
47
|
-
}),
|
|
48
|
-
discountBadgeColor: new ColorSetting({
|
|
49
|
-
title: 'Discount Badge Text Color',
|
|
50
|
-
defaultValue: '#ffffff'
|
|
51
|
-
}),
|
|
52
|
-
ratingColor: new ColorSetting({
|
|
53
|
-
title: 'Rating Star Color',
|
|
54
|
-
defaultValue: '#f0c845'
|
|
55
|
-
})
|
|
56
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ColorSetting, NumberSetting, TextSetting, ListSetting, Settings, type InferSettingsMapType } from '../../settings';
|
|
2
|
-
export declare const termsSettings: Settings<{
|
|
3
|
-
marginTop: NumberSetting;
|
|
4
|
-
title: TextSetting;
|
|
5
|
-
sections: ListSetting;
|
|
6
|
-
backgroundColor: ColorSetting;
|
|
7
|
-
borderColor: ColorSetting;
|
|
8
|
-
textColor: ColorSetting;
|
|
9
|
-
arrowBackground: ColorSetting;
|
|
10
|
-
}>;
|
|
11
|
-
export type TermsSettingsMap = InferSettingsMapType<typeof termsSettings>;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ColorSetting, NumberSetting, TextSetting, ListSetting, Settings } from '../../settings';
|
|
2
|
-
export const termsSettings = new Settings('Terms', {
|
|
3
|
-
marginTop: new NumberSetting({
|
|
4
|
-
title: 'Margin Top',
|
|
5
|
-
defaultValue: 0
|
|
6
|
-
}),
|
|
7
|
-
title: new TextSetting({
|
|
8
|
-
title: 'Title',
|
|
9
|
-
defaultValue: 'Terms & Conditions'
|
|
10
|
-
}),
|
|
11
|
-
sections: new ListSetting({
|
|
12
|
-
title: 'Sections',
|
|
13
|
-
defaultValue: [
|
|
14
|
-
{ title: 'About the Promotion', content: 'Enter promotion details here.' },
|
|
15
|
-
{ title: 'Bonus Game Rules and Prizes', content: 'Enter bonus game rules here.' }
|
|
16
|
-
],
|
|
17
|
-
extra: {
|
|
18
|
-
addButtonText: '+ Add Section',
|
|
19
|
-
titlePlaceholder: 'Section title',
|
|
20
|
-
contentPlaceholder: 'Section content'
|
|
21
|
-
}
|
|
22
|
-
}),
|
|
23
|
-
backgroundColor: new ColorSetting({
|
|
24
|
-
title: 'Background Color',
|
|
25
|
-
defaultValue: '#162D3F'
|
|
26
|
-
}),
|
|
27
|
-
borderColor: new ColorSetting({
|
|
28
|
-
title: 'Border Color',
|
|
29
|
-
defaultValue: 'rgba(177,202,223,0.1)'
|
|
30
|
-
}),
|
|
31
|
-
textColor: new ColorSetting({
|
|
32
|
-
title: 'Text Color',
|
|
33
|
-
defaultValue: '#ffffff'
|
|
34
|
-
}),
|
|
35
|
-
arrowBackground: new ColorSetting({
|
|
36
|
-
title: 'Arrow Background',
|
|
37
|
-
defaultValue: '#33475b'
|
|
38
|
-
})
|
|
39
|
-
});
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { TermsSettingsMap } from './settings';
|
|
3
|
-
|
|
4
|
-
let { settings }: { settings: TermsSettingsMap } = $props();
|
|
5
|
-
|
|
6
|
-
let expandedSet = $state<Set<number>>(new Set());
|
|
7
|
-
|
|
8
|
-
function toggle(index: number) {
|
|
9
|
-
if (expandedSet.has(index)) {
|
|
10
|
-
expandedSet.delete(index);
|
|
11
|
-
} else {
|
|
12
|
-
expandedSet.add(index);
|
|
13
|
-
}
|
|
14
|
-
expandedSet = new Set(expandedSet);
|
|
15
|
-
}
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<div class="terms-wrapper" style="margin-top: {settings.marginTop}px;">
|
|
19
|
-
<div
|
|
20
|
-
class="terms-container"
|
|
21
|
-
style="background-color: {settings.backgroundColor}; border: 1px solid {settings.borderColor};"
|
|
22
|
-
>
|
|
23
|
-
<div class="terms-main-header" style="color: {settings.textColor};">
|
|
24
|
-
<span class="terms-main-title">{settings.title}</span>
|
|
25
|
-
</div>
|
|
26
|
-
|
|
27
|
-
{#each settings.sections as section, i}
|
|
28
|
-
<div class="terms-section" style="border-color: {settings.borderColor};">
|
|
29
|
-
<button class="terms-header" onclick={() => toggle(i)} style="color: {settings.textColor};">
|
|
30
|
-
<span class="terms-title">{section.title}</span>
|
|
31
|
-
<div
|
|
32
|
-
class="terms-arrow"
|
|
33
|
-
class:rotated={expandedSet.has(i)}
|
|
34
|
-
style="background: {settings.arrowBackground};"
|
|
35
|
-
>
|
|
36
|
-
<svg width="16" height="16" viewBox="0 0 16 16" fill="none">
|
|
37
|
-
<path d="M8 11L3 5.5h10L8 11z" fill="currentColor" />
|
|
38
|
-
</svg>
|
|
39
|
-
</div>
|
|
40
|
-
</button>
|
|
41
|
-
{#if expandedSet.has(i)}
|
|
42
|
-
<div class="terms-content" style="color: {settings.textColor};">
|
|
43
|
-
<p>{section.content}</p>
|
|
44
|
-
</div>
|
|
45
|
-
{/if}
|
|
46
|
-
</div>
|
|
47
|
-
{/each}
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
|
|
51
|
-
<style>
|
|
52
|
-
.terms-wrapper {
|
|
53
|
-
max-width: 750px;
|
|
54
|
-
width: 100%;
|
|
55
|
-
margin: 0 auto;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.terms-container {
|
|
59
|
-
border-radius: 8px;
|
|
60
|
-
overflow: hidden;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.terms-main-header {
|
|
64
|
-
padding: 18px 20px;
|
|
65
|
-
border-bottom: 1px solid rgba(177, 202, 223, 0.1);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.terms-main-title {
|
|
69
|
-
font-size: 1.15rem;
|
|
70
|
-
font-weight: 600;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.terms-section {
|
|
74
|
-
border-top: 1px solid;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.terms-section:first-of-type {
|
|
78
|
-
border-top: none;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.terms-header {
|
|
82
|
-
display: flex;
|
|
83
|
-
width: 100%;
|
|
84
|
-
align-items: center;
|
|
85
|
-
justify-content: space-between;
|
|
86
|
-
padding: 16px 20px;
|
|
87
|
-
background: none;
|
|
88
|
-
border: none;
|
|
89
|
-
cursor: pointer;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.terms-title {
|
|
93
|
-
font-size: 1rem;
|
|
94
|
-
font-weight: 500;
|
|
95
|
-
text-align: start;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.terms-arrow {
|
|
99
|
-
display: flex;
|
|
100
|
-
align-items: center;
|
|
101
|
-
justify-content: center;
|
|
102
|
-
width: 30px;
|
|
103
|
-
height: 30px;
|
|
104
|
-
border-radius: 50%;
|
|
105
|
-
padding: 4px;
|
|
106
|
-
transition: transform 0.2s ease;
|
|
107
|
-
flex-shrink: 0;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.terms-arrow.rotated {
|
|
111
|
-
transform: rotate(180deg);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.terms-content {
|
|
115
|
-
padding: 0 20px 20px;
|
|
116
|
-
font-size: 0.875rem;
|
|
117
|
-
line-height: 1.6;
|
|
118
|
-
opacity: 0.8;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.terms-content p {
|
|
122
|
-
margin: 0;
|
|
123
|
-
}
|
|
124
|
-
</style>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { TermsSettingsMap } from './settings';
|
|
2
|
-
type $$ComponentProps = {
|
|
3
|
-
settings: TermsSettingsMap;
|
|
4
|
-
};
|
|
5
|
-
declare const TermsElement: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
-
type TermsElement = ReturnType<typeof TermsElement>;
|
|
7
|
-
export default TermsElement;
|