sveltekit-ui 1.1.16 → 1.1.18
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/dist/Components/Alert/index.svelte +88 -0
- package/dist/Components/Alert/index.svelte.js +101 -0
- package/dist/Components/Audio/index.svelte +193 -0
- package/dist/Components/Audio/index.svelte.js +463 -0
- package/dist/Components/AuthCodeInput/index.svelte +85 -0
- package/dist/Components/AuthCodeInput/index.svelte.js +95 -0
- package/dist/Components/Button/index.svelte +721 -0
- package/dist/Components/Button/index.svelte.js +375 -0
- package/dist/Components/Checkbox/index.svelte +411 -0
- package/dist/Components/Checkbox/index.svelte.js +178 -0
- package/dist/Components/Code/index.svelte +23 -0
- package/dist/Components/Code/index.svelte.js +33 -0
- package/dist/Components/EmailAddress/index.svelte +22 -0
- package/dist/Components/EmailAddress/index.svelte.js +45 -0
- package/dist/Components/Eye/index.svelte +57 -0
- package/dist/Components/Icon/index.svelte +412 -0
- package/dist/Components/Icon/index.svelte.js +116 -0
- package/dist/Components/InfoBox/index.svelte +89 -0
- package/dist/Components/Json/index.svelte +60 -0
- package/dist/Components/Json/index.svelte.js +594 -0
- package/dist/Components/Link/index.svelte +47 -0
- package/dist/Components/Link/index.svelte.js +136 -0
- package/dist/Components/LoadingSuccessDiv/index.svelte +51 -0
- package/dist/Components/Location/index.svelte +79 -0
- package/dist/Components/Location/index.svelte.js +288 -0
- package/dist/Components/PhoneNumber/index.svelte +22 -0
- package/dist/Components/PhoneNumber/index.svelte.js +41 -0
- package/dist/Components/Qr/index.svelte +85 -0
- package/dist/Components/Qr/index.svelte.js +301 -0
- package/dist/Components/QrInput/index.svelte +47 -0
- package/dist/Components/QrInput/index.svelte.js +218 -0
- package/dist/Components/Slider/index.svelte +239 -0
- package/dist/Components/Slider/index.svelte.js +469 -0
- package/dist/Components/SuccessCheck/index.svelte +56 -0
- package/dist/Components/TableAdvanced/index.svelte +275 -0
- package/dist/Components/TableAdvanced/index.svelte.js +1565 -0
- package/dist/Components/TextInput/index.svelte +223 -0
- package/dist/Components/TextInput/index.svelte.js +447 -0
- package/dist/Components/Time/index.svelte +7 -0
- package/dist/Components/Time/index.svelte.js +38 -0
- package/dist/Components/VideoTBD/index.svelte +100 -0
- package/dist/Components/XPost/index.svelte +52 -0
- package/dist/Components/XPost/index.svelte.js +64 -0
- package/package.json +1 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { get_time_object_from_val } from "../TimeInput/index.js"
|
|
2
|
+
import { set_closurable_color, set_closurable } from "../../client/index.js"
|
|
3
|
+
|
|
4
|
+
export function create_time_manager(config) {
|
|
5
|
+
let datetime = $state(null)
|
|
6
|
+
let content = $state(null)
|
|
7
|
+
let text_color = $derived(set_closurable_color(config?.text_color, null))
|
|
8
|
+
|
|
9
|
+
function init(config) {
|
|
10
|
+
const time_full = get_time_object_from_val(
|
|
11
|
+
set_closurable(config?.val),
|
|
12
|
+
set_closurable(config?.format),
|
|
13
|
+
set_closurable(config?.granularity),
|
|
14
|
+
set_closurable(config?.timezone)
|
|
15
|
+
)
|
|
16
|
+
datetime = time_full?.datetime ?? time_full?.iso_8601 ?? null
|
|
17
|
+
content = time_full?.content ?? set_closurable(config?.val)
|
|
18
|
+
if (config?.display_format == "calendar_date" && time_full?.year) {
|
|
19
|
+
content = `${time_full?.year}-${String(time_full?.month).padStart(2, "0")}-${String(
|
|
20
|
+
time_full?.day_of_month
|
|
21
|
+
).padStart(2, "0")}`
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
init(config)
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
get text_color() {
|
|
29
|
+
return text_color
|
|
30
|
+
},
|
|
31
|
+
get datetime() {
|
|
32
|
+
return datetime
|
|
33
|
+
},
|
|
34
|
+
get content() {
|
|
35
|
+
return content
|
|
36
|
+
},
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { create_unique_id } from "../../client/index.js"
|
|
3
|
+
import { onMount } from "svelte"
|
|
4
|
+
|
|
5
|
+
function create_video_manager(config) {
|
|
6
|
+
const id = create_unique_id(null, 20)
|
|
7
|
+
let step = $state(null)
|
|
8
|
+
|
|
9
|
+
function draw() {
|
|
10
|
+
let video_el = document?.querySelector(`#video_${id}`)
|
|
11
|
+
let canvas_el = document?.querySelector(`#canvas_${id}`)
|
|
12
|
+
if (video_el && canvas_el) {
|
|
13
|
+
let ctx = canvas_el.getContext("2d")
|
|
14
|
+
ctx.filter = "blur(1px)"
|
|
15
|
+
ctx.drawImage(video_el, 0, 0, canvas_el.width, canvas_el.height)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function draw_loop() {
|
|
20
|
+
draw()
|
|
21
|
+
step = window.requestAnimationFrame(draw_loop)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function draw_pause() {
|
|
25
|
+
window.cancelAnimationFrame(step)
|
|
26
|
+
step = undefined
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
id,
|
|
31
|
+
draw,
|
|
32
|
+
draw_loop,
|
|
33
|
+
draw_pause,
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let manager = $state(null)
|
|
38
|
+
onMount(() => {
|
|
39
|
+
manager = create_video_manager()
|
|
40
|
+
})
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<section class="wrapper">
|
|
44
|
+
<video
|
|
45
|
+
id={`video_${manager?.id}`}
|
|
46
|
+
controls
|
|
47
|
+
muted
|
|
48
|
+
class="video"
|
|
49
|
+
src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
|
|
50
|
+
onpause={(e) => manager?.draw_pause(e)}
|
|
51
|
+
onended={(e) => manager?.draw_pause(e)}
|
|
52
|
+
onplay={(e) => manager?.draw_loop(e)}
|
|
53
|
+
onseeked={(e) => manager?.draw(e)}
|
|
54
|
+
onloadeddata={(e) => manager?.draw(e)}
|
|
55
|
+
></video>
|
|
56
|
+
<canvas width="10" height="6" aria-hidden="true" class="canvas" id={`canvas_${manager?.id}`}></canvas>
|
|
57
|
+
</section>
|
|
58
|
+
|
|
59
|
+
<style>
|
|
60
|
+
*,
|
|
61
|
+
*::before,
|
|
62
|
+
*::after {
|
|
63
|
+
box-sizing: border-box;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.video,
|
|
67
|
+
.canvas {
|
|
68
|
+
display: block;
|
|
69
|
+
width: 100%;
|
|
70
|
+
height: auto;
|
|
71
|
+
margin: 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.wrapper {
|
|
75
|
+
position: relative;
|
|
76
|
+
box-shadow: inset 0 0 4rem 4.5rem var(--color-background);
|
|
77
|
+
max-width: 1600px;
|
|
78
|
+
margin: 0 auto;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.canvas {
|
|
82
|
+
position: absolute;
|
|
83
|
+
top: 0;
|
|
84
|
+
left: 0;
|
|
85
|
+
z-index: -1;
|
|
86
|
+
width: 100%;
|
|
87
|
+
height: 100%;
|
|
88
|
+
opacity: 0.4;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.video {
|
|
92
|
+
padding: 7rem;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@media (prefers-reduced-motion: reduce) {
|
|
96
|
+
.canvas {
|
|
97
|
+
display: none !important;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
</style>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import LoadingWheel from "../LoadingWheel/index.svelte"
|
|
3
|
+
|
|
4
|
+
let { manager } = $props()
|
|
5
|
+
|
|
6
|
+
$effect(() => {
|
|
7
|
+
if (typeof manager?.load_script == "function") {
|
|
8
|
+
manager?.load_script()
|
|
9
|
+
}
|
|
10
|
+
})
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div id={manager?.selector_id}>
|
|
14
|
+
{#if manager?.is_loading}
|
|
15
|
+
<div
|
|
16
|
+
style="width: 100%; height: 30rem; display: grid; place-items: center; background-color: var(--shadow2-t); border-radius: 1rem;"
|
|
17
|
+
>
|
|
18
|
+
<LoadingWheel size={8} />
|
|
19
|
+
<p>Loading post</p>
|
|
20
|
+
</div>
|
|
21
|
+
{/if}
|
|
22
|
+
{#if manager?.error_message}
|
|
23
|
+
<div class="failed_to_load_box">
|
|
24
|
+
<p>{manager?.error_message}</p>
|
|
25
|
+
<a href="https://x.com/status/{manager?.post_id}">https://x.com/status/{manager?.post_id}</a>
|
|
26
|
+
</div>
|
|
27
|
+
{/if}
|
|
28
|
+
<div class="x_post_container">
|
|
29
|
+
<div id={`x_post_${manager?.id}`} class:is_hidden={!!manager?.error_message}></div>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<style>
|
|
34
|
+
.failed_to_load_box {
|
|
35
|
+
margin: 1rem 0;
|
|
36
|
+
background-color: oklch(var(--l8-t) var(--c16) var(--h3) / var(--o3));
|
|
37
|
+
border-radius: 1rem;
|
|
38
|
+
padding: 1rem;
|
|
39
|
+
}
|
|
40
|
+
.failed_to_load_box p {
|
|
41
|
+
color: oklch(var(--l3-t) var(--c16) var(--h3));
|
|
42
|
+
}
|
|
43
|
+
.is_hidden {
|
|
44
|
+
max-width: 0;
|
|
45
|
+
max-height: 0;
|
|
46
|
+
overflow: hidden;
|
|
47
|
+
}
|
|
48
|
+
.x_post_container {
|
|
49
|
+
max-width: 100% !important;
|
|
50
|
+
overflow-x: scroll;
|
|
51
|
+
}
|
|
52
|
+
</style>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { create_unique_id } from "../../client/index.js"
|
|
2
|
+
|
|
3
|
+
export function create_x_post_manager(config) {
|
|
4
|
+
const id = create_unique_id(null, 20)
|
|
5
|
+
|
|
6
|
+
let is_loading = $state(false)
|
|
7
|
+
let is_script_loaded = $state(false)
|
|
8
|
+
let error_message = $state("")
|
|
9
|
+
|
|
10
|
+
let is_dark_theme = $derived(config?.is_dark_theme)
|
|
11
|
+
let theme = $derived(config?.is_dark_theme ? "dark" : "light")
|
|
12
|
+
|
|
13
|
+
function load_script() {
|
|
14
|
+
error_message = null
|
|
15
|
+
if (!is_script_loaded) {
|
|
16
|
+
const script = document.createElement("script")
|
|
17
|
+
script.src = "https://platform.twitter.com/widgets.js"
|
|
18
|
+
script.charset = "utf-8"
|
|
19
|
+
script.async = true
|
|
20
|
+
script.onload = () => {
|
|
21
|
+
is_script_loaded = true
|
|
22
|
+
render_x_post()
|
|
23
|
+
}
|
|
24
|
+
document.head.appendChild(script)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async function render_x_post() {
|
|
29
|
+
try {
|
|
30
|
+
error_message = ""
|
|
31
|
+
is_loading = true
|
|
32
|
+
let container_el = document?.querySelector(`#x_post_${id}`)
|
|
33
|
+
if (config?.post_id && is_script_loaded && window.twttr && container_el) {
|
|
34
|
+
const create_embed_res = await twttr.widgets.createTweet(config?.post_id, container_el, {
|
|
35
|
+
theme: theme,
|
|
36
|
+
dnt: true,
|
|
37
|
+
})
|
|
38
|
+
if (create_embed_res) {
|
|
39
|
+
error_message = ""
|
|
40
|
+
} else {
|
|
41
|
+
error_message = "Post not found or failed to load."
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
} catch {
|
|
45
|
+
error_message = "Post not found or failed to load."
|
|
46
|
+
} finally {
|
|
47
|
+
is_loading = false
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
id,
|
|
53
|
+
get post_id() {
|
|
54
|
+
return config?.post_id
|
|
55
|
+
},
|
|
56
|
+
get is_dark_theme() {
|
|
57
|
+
return is_dark_theme
|
|
58
|
+
},
|
|
59
|
+
get theme() {
|
|
60
|
+
return theme
|
|
61
|
+
},
|
|
62
|
+
load_script,
|
|
63
|
+
}
|
|
64
|
+
}
|