@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.
Files changed (54) hide show
  1. package/README.md +1 -65
  2. package/dist/elements/accordion/accordionElement.svelte +101 -0
  3. package/dist/elements/accordion/accordionElement.svelte.d.ts +7 -0
  4. package/dist/elements/accordion/settings.d.ts +17 -0
  5. package/dist/elements/accordion/settings.js +54 -0
  6. package/dist/elements/badge/badgeElement.svelte +4 -3
  7. package/dist/elements/badge/settings.d.ts +3 -2
  8. package/dist/elements/badge/settings.js +20 -30
  9. package/dist/elements/banner/bannerElement.svelte +38 -10
  10. package/dist/elements/banner/settings.d.ts +5 -3
  11. package/dist/elements/banner/settings.js +15 -10
  12. package/dist/elements/button/buttonElement.svelte +7 -3
  13. package/dist/elements/button/settings.d.ts +1 -0
  14. package/dist/elements/button/settings.js +10 -6
  15. package/dist/elements/ctaCard/ctaCardElement.svelte +132 -0
  16. package/dist/elements/ctaCard/ctaCardElement.svelte.d.ts +7 -0
  17. package/dist/elements/ctaCard/settings.d.ts +22 -0
  18. package/dist/elements/ctaCard/settings.js +64 -0
  19. package/dist/elements/text/settings.d.ts +11 -6
  20. package/dist/elements/text/settings.js +48 -4
  21. package/dist/elements/text/textElement.svelte +7 -2
  22. package/dist/renderer/registry.js +8 -14
  23. package/dist/renderer/renderer.vanilla.es.js +1172 -1354
  24. package/dist/renderer/renderer.vanilla.umd.js +27 -19
  25. package/dist/settings/base.svelte.js +3 -5
  26. package/dist/settings/components/ColorSettings.svelte +6 -6
  27. package/dist/settings/components/ListSettings.svelte +12 -12
  28. package/dist/settings/components/NumberSettings.svelte +6 -6
  29. package/dist/settings/components/SelectSettings.svelte +6 -6
  30. package/dist/settings/components/SettingsGroup.svelte +3 -3
  31. package/dist/settings/components/TextSettings.svelte +53 -2
  32. package/dist/settings/components/TranslatableSettings.svelte +15 -15
  33. package/dist/settings/components/UploadSettings.svelte +6 -6
  34. package/package.json +4 -4
  35. package/dist/elements/auth/authElement.svelte +0 -115
  36. package/dist/elements/auth/authElement.svelte.d.ts +0 -7
  37. package/dist/elements/auth/settings.d.ts +0 -25
  38. package/dist/elements/auth/settings.js +0 -63
  39. package/dist/elements/cards/cardsElement.svelte +0 -136
  40. package/dist/elements/cards/cardsElement.svelte.d.ts +0 -7
  41. package/dist/elements/cards/settings.d.ts +0 -14
  42. package/dist/elements/cards/settings.js +0 -52
  43. package/dist/elements/divider/dividerElement.svelte +0 -34
  44. package/dist/elements/divider/dividerElement.svelte.d.ts +0 -7
  45. package/dist/elements/divider/settings.d.ts +0 -7
  46. package/dist/elements/divider/settings.js +0 -15
  47. package/dist/elements/products/productsElement.svelte +0 -283
  48. package/dist/elements/products/productsElement.svelte.d.ts +0 -7
  49. package/dist/elements/products/settings.d.ts +0 -16
  50. package/dist/elements/products/settings.js +0 -56
  51. package/dist/elements/terms/settings.d.ts +0 -11
  52. package/dist/elements/terms/settings.js +0 -39
  53. package/dist/elements/terms/termsElement.svelte +0 -124
  54. package/dist/elements/terms/termsElement.svelte.d.ts +0 -7
package/README.md CHANGED
@@ -1,65 +1 @@
1
- # Svelte library
2
-
3
- Everything you need to build a Svelte library, powered by [`sv`](https://npmjs.com/package/sv).
4
-
5
- Read more about creating a library [in the docs](https://svelte.dev/docs/kit/packaging).
6
-
7
- ## Creating a project
8
-
9
- If you're seeing this, you've probably already done this step. Congrats!
10
-
11
- ```sh
12
- # create a new project in the current directory
13
- npx sv create
14
-
15
- # create a new project in my-app
16
- npx sv create my-app
17
- ```
18
-
19
- To recreate this project with the same configuration:
20
-
21
- ```sh
22
- # recreate this project
23
- pnpm dlx sv@0.12.8 create --template library --types ts --add prettier eslint vitest="usages:unit,component" tailwindcss="plugins:typography,forms" --install pnpm build
24
- ```
25
-
26
- ## Developing
27
-
28
- Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
29
-
30
- ```sh
31
- npm run dev
32
-
33
- # or start the server and open the app in a new browser tab
34
- npm run dev -- --open
35
- ```
36
-
37
- Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
38
-
39
- ## Building
40
-
41
- To build your library:
42
-
43
- ```sh
44
- npm pack
45
- ```
46
-
47
- To create a production version of your showcase app:
48
-
49
- ```sh
50
- npm run build
51
- ```
52
-
53
- You can preview the production build with `npm run preview`.
54
-
55
- > To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
56
-
57
- ## Publishing
58
-
59
- Go into the `package.json` and give your package the desired name through the `"name"` option. Also consider adding a `"license"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).
60
-
61
- To publish your library to [npm](https://www.npmjs.com):
62
-
63
- ```sh
64
- npm publish
65
- ```
1
+ # builder
@@ -0,0 +1,101 @@
1
+ <script lang="ts">
2
+ import type { AccordionSettingsMap } from './settings';
3
+
4
+ let { settings }: { settings: AccordionSettingsMap } = $props();
5
+
6
+ let expandedIndex = $state<number | null>(null);
7
+
8
+ function toggle(index: number): void {
9
+ expandedIndex = expandedIndex === index ? null : index;
10
+ }
11
+ </script>
12
+
13
+ <div class="accordion-wrapper" style="margin-top: {settings.marginTop}px; gap: {settings.gap}px;">
14
+ {#each settings.sections as section, i}
15
+ <div
16
+ class="accordion-section"
17
+ style="background-color: {settings.backgroundColor}; border: 1px solid {settings.borderColor};"
18
+ >
19
+ <button
20
+ class="accordion-header"
21
+ style="color: {settings.textColor};"
22
+ onclick={() => toggle(i)}
23
+ >
24
+ <span class="accordion-title">{section.title}</span>
25
+ <div
26
+ class="accordion-arrow"
27
+ class:rotated={expandedIndex === i}
28
+ style="background: {settings.arrowBackground}; border: 0.5px solid {settings.arrowBorderColor};"
29
+ >
30
+ <svg width="15" height="15" viewBox="0 0 16 16" fill="none">
31
+ <path d="M8 11L3 5.5h10L8 11z" fill="currentColor" />
32
+ </svg>
33
+ </div>
34
+ </button>
35
+ {#if expandedIndex === i}
36
+ <div class="accordion-content" style="color: {settings.contentColor};">
37
+ <p>{section.content}</p>
38
+ </div>
39
+ {/if}
40
+ </div>
41
+ {/each}
42
+ </div>
43
+
44
+ <style>
45
+ .accordion-wrapper {
46
+ display: flex;
47
+ flex-direction: column;
48
+ max-width: 750px;
49
+ width: 100%;
50
+ margin: 0 auto;
51
+ }
52
+
53
+ .accordion-section {
54
+ border-radius: 8px;
55
+ overflow: hidden;
56
+ }
57
+
58
+ .accordion-header {
59
+ display: flex;
60
+ width: 100%;
61
+ align-items: center;
62
+ justify-content: space-between;
63
+ padding: 16px;
64
+ background: none;
65
+ border: none;
66
+ cursor: pointer;
67
+ text-align: left;
68
+ }
69
+
70
+ .accordion-title {
71
+ font-size: 1.1rem;
72
+ font-weight: 600;
73
+ }
74
+
75
+ .accordion-arrow {
76
+ display: flex;
77
+ align-items: center;
78
+ justify-content: center;
79
+ width: 30px;
80
+ height: 30px;
81
+ border-radius: 50%;
82
+ transition: transform 0.2s ease-in-out;
83
+ flex-shrink: 0;
84
+ backdrop-filter: blur(15px);
85
+ }
86
+
87
+ .accordion-arrow.rotated {
88
+ transform: rotate(180deg);
89
+ }
90
+
91
+ .accordion-content {
92
+ padding: 0 16px 16px;
93
+ font-size: 0.875rem;
94
+ line-height: 1.6;
95
+ }
96
+
97
+ .accordion-content p {
98
+ margin: 0;
99
+ white-space: pre-wrap;
100
+ }
101
+ </style>
@@ -0,0 +1,7 @@
1
+ import type { AccordionSettingsMap } from './settings';
2
+ type $$ComponentProps = {
3
+ settings: AccordionSettingsMap;
4
+ };
5
+ declare const AccordionElement: import("svelte").Component<$$ComponentProps, {}, "">;
6
+ type AccordionElement = ReturnType<typeof AccordionElement>;
7
+ export default AccordionElement;
@@ -0,0 +1,17 @@
1
+ import { ColorSetting, NumberSetting, ListSetting, Settings, type InferSettingsMapType } from '../../settings';
2
+ export declare const accordionSettings: Settings<{
3
+ sections: ListSetting;
4
+ style: Settings<{
5
+ backgroundColor: ColorSetting;
6
+ borderColor: ColorSetting;
7
+ textColor: ColorSetting;
8
+ contentColor: ColorSetting;
9
+ arrowBackground: ColorSetting;
10
+ arrowBorderColor: ColorSetting;
11
+ }>;
12
+ layout: Settings<{
13
+ marginTop: NumberSetting;
14
+ gap: NumberSetting;
15
+ }>;
16
+ }>;
17
+ export type AccordionSettingsMap = InferSettingsMapType<typeof accordionSettings>;
@@ -0,0 +1,54 @@
1
+ import { ColorSetting, NumberSetting, ListSetting, Settings } from '../../settings';
2
+ export const accordionSettings = new Settings('Accordion', {
3
+ sections: new ListSetting({
4
+ title: 'Sections',
5
+ defaultValue: [
6
+ { title: 'What is Bet Builder?', content: 'Bet Builder lets you combine multiple selections from the same match into one bet.' },
7
+ { title: 'How to Build a Bet', content: '1. Pick a match\n2. Select your markets\n3. Confirm your bet' },
8
+ { title: 'How It Works', content: 'Choose from available markets and combine them for bigger odds.' },
9
+ { title: 'Important Terms', content: 'All selections must be from the same match. Minimum odds may apply.' }
10
+ ],
11
+ extra: {
12
+ addButtonText: '+ Add Section',
13
+ titlePlaceholder: 'Section title',
14
+ contentPlaceholder: 'Section content'
15
+ }
16
+ }),
17
+ style: new Settings('Style', {
18
+ backgroundColor: new ColorSetting({
19
+ title: 'Background Color',
20
+ defaultValue: '#142636'
21
+ }),
22
+ borderColor: new ColorSetting({
23
+ title: 'Border Color',
24
+ defaultValue: 'rgba(177,202,223,0.05)'
25
+ }),
26
+ textColor: new ColorSetting({
27
+ title: 'Text Color',
28
+ defaultValue: '#ffffff'
29
+ }),
30
+ contentColor: new ColorSetting({
31
+ title: 'Content Text Color',
32
+ defaultValue: 'rgba(255,255,255,0.6)'
33
+ }),
34
+ arrowBackground: new ColorSetting({
35
+ title: 'Arrow Background',
36
+ defaultValue: 'rgba(228,246,255,0.1)'
37
+ }),
38
+ arrowBorderColor: new ColorSetting({
39
+ title: 'Arrow Border Color',
40
+ defaultValue: 'rgba(177,202,223,0.1)'
41
+ })
42
+ }),
43
+ layout: new Settings('Layout', {
44
+ marginTop: new NumberSetting({
45
+ title: 'Margin Top',
46
+ defaultValue: 0
47
+ }),
48
+ gap: new NumberSetting({
49
+ title: 'Gap Between Sections',
50
+ defaultValue: 12,
51
+ extra: { min: 0, max: 32, step: 1 }
52
+ })
53
+ })
54
+ });
@@ -12,14 +12,14 @@
12
12
 
13
13
  <div
14
14
  class="badge-wrapper"
15
- style="justify-content: {justifyMap[settings.align] ??
16
- 'center'}; margin-top: {settings.marginTop}px;"
15
+ style="justify-content: {justifyMap[settings.align] ?? 'center'}; margin-top: {settings.marginTop}px;"
17
16
  >
18
17
  <span
19
18
  class="badge"
20
19
  style="
21
20
  background: {settings.backgroundColor};
22
21
  color: {settings.textColor};
22
+ border: 0.5px solid {settings.borderColor};
23
23
  border-radius: {settings.borderRadius}px;
24
24
  padding: {settings.paddingY}px {settings.paddingX}px;
25
25
  font-size: {settings.fontSize}px;
@@ -39,10 +39,11 @@
39
39
 
40
40
  .badge {
41
41
  display: inline-block;
42
- font-weight: 700;
42
+ font-weight: 500;
43
43
  text-transform: uppercase;
44
44
  letter-spacing: 0.06em;
45
45
  line-height: 1;
46
46
  white-space: nowrap;
47
+ backdrop-filter: blur(12px);
47
48
  }
48
49
  </style>
@@ -1,13 +1,14 @@
1
1
  import { ColorSetting, NumberSetting, TextSetting, Settings, type InferSettingsMapType } from '../../settings';
2
2
  export declare const badgeSettings: Settings<{
3
- marginTop: NumberSetting;
4
3
  text: TextSetting;
5
4
  backgroundColor: ColorSetting;
6
5
  textColor: ColorSetting;
6
+ borderColor: ColorSetting;
7
7
  borderRadius: NumberSetting;
8
+ fontSize: NumberSetting;
8
9
  paddingX: NumberSetting;
9
10
  paddingY: NumberSetting;
10
- fontSize: NumberSetting;
11
+ marginTop: NumberSetting;
11
12
  align: TextSetting;
12
13
  }>;
13
14
  export type BadgeSettingsMap = InferSettingsMapType<typeof badgeSettings>;
@@ -1,54 +1,44 @@
1
1
  import { ColorSetting, NumberSetting, TextSetting, Settings } from '../../settings';
2
2
  export const badgeSettings = new Settings('Badge', {
3
- marginTop: new NumberSetting({
4
- title: 'Margin Top',
5
- defaultValue: 0
6
- }),
7
3
  text: new TextSetting({
8
4
  title: 'Badge Text',
9
- defaultValue: 'NEW'
5
+ defaultValue: 'BUILD YOUR BET'
10
6
  }),
11
7
  backgroundColor: new ColorSetting({
12
8
  title: 'Background Color',
13
- defaultValue: '#f0c845'
9
+ defaultValue: 'rgba(63,185,80,0.2)'
14
10
  }),
15
11
  textColor: new ColorSetting({
16
12
  title: 'Text Color',
17
- defaultValue: '#000000'
13
+ defaultValue: '#9AE600'
14
+ }),
15
+ borderColor: new ColorSetting({
16
+ title: 'Border Color',
17
+ defaultValue: 'rgba(154,230,0,0.15)'
18
18
  }),
19
19
  borderRadius: new NumberSetting({
20
20
  title: 'Border Radius',
21
- defaultValue: 20,
22
- extra: {
23
- min: 0,
24
- max: 50,
25
- step: 1
26
- }
21
+ defaultValue: 50,
22
+ extra: { min: 0, max: 50, step: 1 }
23
+ }),
24
+ fontSize: new NumberSetting({
25
+ title: 'Font Size',
26
+ defaultValue: 14,
27
+ extra: { min: 8, max: 32, step: 1 }
27
28
  }),
28
29
  paddingX: new NumberSetting({
29
30
  title: 'Padding Horizontal',
30
- defaultValue: 16,
31
- extra: {
32
- min: 0,
33
- step: 1
34
- }
31
+ defaultValue: 12,
32
+ extra: { min: 0, step: 1 }
35
33
  }),
36
34
  paddingY: new NumberSetting({
37
35
  title: 'Padding Vertical',
38
36
  defaultValue: 6,
39
- extra: {
40
- min: 0,
41
- step: 1
42
- }
37
+ extra: { min: 0, step: 1 }
43
38
  }),
44
- fontSize: new NumberSetting({
45
- title: 'Font Size',
46
- defaultValue: 12,
47
- extra: {
48
- min: 8,
49
- max: 32,
50
- step: 1
51
- }
39
+ marginTop: new NumberSetting({
40
+ title: 'Margin Top',
41
+ defaultValue: 0
52
42
  }),
53
43
  align: new TextSetting({
54
44
  title: 'Align (left / center / right)',
@@ -4,24 +4,52 @@
4
4
  let { settings }: { settings: BannerSettingsMap } = $props();
5
5
  </script>
6
6
 
7
- {#if settings.image}
8
- <img src={settings.image} alt="Banner" class="banner-image" />
9
- {:else}
10
- <div class="banner-placeholder">
11
- <span class="placeholder-icon">&#128444;</span>
12
- <span class="placeholder-text">No image — select this element and upload one</span>
13
- </div>
14
- {/if}
7
+ <div
8
+ class="banner-wrapper"
9
+ style="background-color: {settings.backgroundColor}; min-height: {settings.minHeight}px;"
10
+ >
11
+ {#if settings.desktopImage}
12
+ <img src={settings.desktopImage} alt="Banner" class="banner-desktop" />
13
+ {/if}
14
+ {#if settings.mobileImage}
15
+ <img src={settings.mobileImage} alt="Banner mobile" class="banner-mobile" />
16
+ {/if}
17
+ {#if !settings.desktopImage && !settings.mobileImage}
18
+ <div class="banner-placeholder">
19
+ <span class="placeholder-icon">&#128444;</span>
20
+ <span class="placeholder-text">Upload desktop and/or mobile banner images</span>
21
+ </div>
22
+ {/if}
23
+ </div>
15
24
 
16
25
  <style>
17
- .banner-image {
26
+ .banner-wrapper {
27
+ position: relative;
28
+ width: 100%;
29
+ overflow: hidden;
30
+ }
31
+
32
+ .banner-desktop,
33
+ .banner-mobile {
18
34
  display: block;
19
35
  width: 100%;
20
36
  height: auto;
21
- max-height: 480px;
22
37
  object-fit: cover;
23
38
  }
24
39
 
40
+ .banner-mobile {
41
+ display: none;
42
+ }
43
+
44
+ @media (max-width: 768px) {
45
+ .banner-desktop {
46
+ display: none;
47
+ }
48
+ .banner-mobile {
49
+ display: block;
50
+ }
51
+ }
52
+
25
53
  .banner-placeholder {
26
54
  display: flex;
27
55
  flex-direction: column;
@@ -1,6 +1,8 @@
1
- import { NumberSetting, UploadSetting, Settings, type InferSettingsMapType } from '../../settings';
1
+ import { ColorSetting, NumberSetting, UploadSetting, Settings, type InferSettingsMapType } from '../../settings';
2
2
  export declare const bannerSettings: Settings<{
3
- image: UploadSetting;
4
- number: NumberSetting;
3
+ desktopImage: UploadSetting;
4
+ mobileImage: UploadSetting;
5
+ backgroundColor: ColorSetting;
6
+ minHeight: NumberSetting;
5
7
  }>;
6
8
  export type BannerSettingsMap = InferSettingsMapType<typeof bannerSettings>;
@@ -1,15 +1,20 @@
1
- import { NumberSetting, UploadSetting, Settings } from '../../settings';
1
+ import { ColorSetting, NumberSetting, UploadSetting, Settings } from '../../settings';
2
2
  export const bannerSettings = new Settings('Banner', {
3
- image: new UploadSetting({
4
- title: 'Image',
3
+ desktopImage: new UploadSetting({
4
+ title: 'Desktop Image',
5
5
  defaultValue: ''
6
6
  }),
7
- number: new NumberSetting({
8
- title: 'Number',
9
- defaultValue: 123,
10
- extra: {
11
- min: 0,
12
- step: 1
13
- }
7
+ mobileImage: new UploadSetting({
8
+ title: 'Mobile Image',
9
+ defaultValue: ''
10
+ }),
11
+ backgroundColor: new ColorSetting({
12
+ title: 'Background Color',
13
+ defaultValue: '#10202D'
14
+ }),
15
+ minHeight: new NumberSetting({
16
+ title: 'Min Height (px)',
17
+ defaultValue: 400,
18
+ extra: { min: 100, max: 1000, step: 10 }
14
19
  })
15
20
  });
@@ -5,9 +5,10 @@
5
5
  </script>
6
6
 
7
7
  <div class="button-wrapper" style="margin-top: {settings.marginTop}px;">
8
- <button
8
+ <a
9
+ href={settings.link}
9
10
  class="cta-button"
10
- style="
11
+ style="
11
12
  background: {settings.backgroundColor};
12
13
  color: {settings.textColor};
13
14
  border-radius: {settings.borderRadius}px;
@@ -16,7 +17,7 @@
16
17
  "
17
18
  >
18
19
  {settings.text}
19
- </button>
20
+ </a>
20
21
  </div>
21
22
 
22
23
  <style>
@@ -29,10 +30,13 @@
29
30
  }
30
31
 
31
32
  .cta-button {
33
+ display: inline-block;
32
34
  font-weight: 700;
33
35
  border: none;
34
36
  cursor: pointer;
35
37
  letter-spacing: 0.02em;
38
+ text-decoration: none;
39
+ text-align: center;
36
40
  transition: opacity 0.2s ease;
37
41
  }
38
42
 
@@ -1,6 +1,7 @@
1
1
  import { ColorSetting, NumberSetting, TextSetting, Settings, type InferSettingsMapType } from '../../settings';
2
2
  export declare const buttonSettings: Settings<{
3
3
  text: TextSetting;
4
+ link: TextSetting;
4
5
  style: Settings<{
5
6
  backgroundColor: ColorSetting;
6
7
  textColor: ColorSetting;
@@ -2,20 +2,24 @@ import { ColorSetting, NumberSetting, TextSetting, Settings } from '../../settin
2
2
  export const buttonSettings = new Settings('Button', {
3
3
  text: new TextSetting({
4
4
  title: 'Button Text',
5
- defaultValue: 'Bet Now'
5
+ defaultValue: 'READY TO BUILD'
6
+ }),
7
+ link: new TextSetting({
8
+ title: 'Link URL',
9
+ defaultValue: '/crypto-sportsbook'
6
10
  }),
7
11
  style: new Settings('Style', {
8
12
  backgroundColor: new ColorSetting({
9
13
  title: 'Background Color',
10
- defaultValue: '#f0c845'
14
+ defaultValue: '#2EA043'
11
15
  }),
12
16
  textColor: new ColorSetting({
13
17
  title: 'Text Color',
14
- defaultValue: '#000000'
18
+ defaultValue: '#ffffff'
15
19
  }),
16
20
  fontSize: new NumberSetting({
17
21
  title: 'Font Size',
18
- defaultValue: 18,
22
+ defaultValue: 16,
19
23
  extra: { min: 10, max: 48, step: 1 }
20
24
  }),
21
25
  borderRadius: new NumberSetting({
@@ -31,12 +35,12 @@ export const buttonSettings = new Settings('Button', {
31
35
  }),
32
36
  paddingX: new NumberSetting({
33
37
  title: 'Padding Horizontal',
34
- defaultValue: 48,
38
+ defaultValue: 46,
35
39
  extra: { min: 0, step: 1 }
36
40
  }),
37
41
  paddingY: new NumberSetting({
38
42
  title: 'Padding Vertical',
39
- defaultValue: 18,
43
+ defaultValue: 16,
40
44
  extra: { min: 0, step: 1 }
41
45
  })
42
46
  })