@hkdigital/lib-sveltekit 0.0.31
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 +104 -0
- package/dist/classes/index.d.ts +2 -0
- package/dist/classes/index.js +2 -0
- package/dist/classes/stores/SubscribersCount.d.ts +39 -0
- package/dist/classes/stores/SubscribersCount.js +107 -0
- package/dist/classes/stores/index.d.ts +1 -0
- package/dist/classes/stores/index.js +1 -0
- package/dist/classes/streams/LogTransformStream.d.ts +4 -0
- package/dist/classes/streams/LogTransformStream.js +19 -0
- package/dist/classes/streams/ServerEventsStore.d.ts +22 -0
- package/dist/classes/streams/ServerEventsStore.js +110 -0
- package/dist/classes/streams/TimeStampSource.d.ts +13 -0
- package/dist/classes/streams/TimeStampSource.js +26 -0
- package/dist/classes/streams/index.d.ts +3 -0
- package/dist/classes/streams/index.js +3 -0
- package/dist/components/area/HkArea.svelte +49 -0
- package/dist/components/area/HkArea.svelte.d.ts +12 -0
- package/dist/components/area/HkGridArea.svelte +77 -0
- package/dist/components/area/HkGridArea.svelte.d.ts +20 -0
- package/dist/components/area/index.d.ts +2 -0
- package/dist/components/area/index.js +2 -0
- package/dist/components/icon/HkIcon.svelte +86 -0
- package/dist/components/icon/HkIcon.svelte.d.ts +10 -0
- package/dist/components/icon/HkTabIcon.svelte +112 -0
- package/dist/components/icon/HkTabIcon.svelte.d.ts +19 -0
- package/dist/components/icon/index.d.ts +3 -0
- package/dist/components/icon/index.js +4 -0
- package/dist/components/icon/typedef.d.ts +13 -0
- package/dist/components/icon/typedef.js +16 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +2 -0
- package/dist/components/layout/HkAppLayout.state.svelte.d.ts +6 -0
- package/dist/components/layout/HkAppLayout.state.svelte.js +25 -0
- package/dist/components/layout/HkAppLayout.svelte +251 -0
- package/dist/components/layout/HkAppLayout.svelte.d.ts +8 -0
- package/dist/components/layout/HkGridLayers.svelte +72 -0
- package/dist/components/layout/HkGridLayers.svelte.d.ts +20 -0
- package/dist/components/layout/index.d.ts +3 -0
- package/dist/components/layout/index.js +9 -0
- package/dist/components/tab-bar/HkTabBar.state.svelte.d.ts +54 -0
- package/dist/components/tab-bar/HkTabBar.state.svelte.js +149 -0
- package/dist/components/tab-bar/HkTabBar.svelte +74 -0
- package/dist/components/tab-bar/HkTabBar.svelte.d.ts +16 -0
- package/dist/components/tab-bar/HkTabBarSelector.state.svelte.d.ts +19 -0
- package/dist/components/tab-bar/HkTabBarSelector.state.svelte.js +93 -0
- package/dist/components/tab-bar/HkTabBarSelector.svelte +49 -0
- package/dist/components/tab-bar/HkTabBarSelector.svelte.d.ts +17 -0
- package/dist/components/tab-bar/index.d.ts +5 -0
- package/dist/components/tab-bar/index.js +17 -0
- package/dist/components/tab-bar/typedef.d.ts +6 -0
- package/dist/components/tab-bar/typedef.js +8 -0
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.js +2 -0
- package/dist/constants/regexp/index.d.ts +3 -0
- package/dist/constants/regexp/index.js +31 -0
- package/dist/constants/regexp/inspiratie.js__ +95 -0
- package/dist/constants/regexp/text.d.ts +47 -0
- package/dist/constants/regexp/text.js +49 -0
- package/dist/constants/regexp/user.d.ts +6 -0
- package/dist/constants/regexp/user.js +33 -0
- package/dist/constants/regexp/web.d.ts +1 -0
- package/dist/constants/regexp/web.js +3 -0
- package/dist/constants/time.d.ts +19 -0
- package/dist/constants/time.js +28 -0
- package/dist/css/test.css +3 -0
- package/dist/css/utilities.postcss +44 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +9 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +1 -0
- package/dist/server/logger.d.ts +24 -0
- package/dist/server/logger.js +94 -0
- package/dist/states/index.d.ts +1 -0
- package/dist/states/index.js +1 -0
- package/dist/states/navigation.svelte.d.ts +23 -0
- package/dist/states/navigation.svelte.js +55 -0
- package/dist/stores/index.d.ts +1 -0
- package/dist/stores/index.js +1 -0
- package/dist/stores/theme.d.ts +28 -0
- package/dist/stores/theme.js +80 -0
- package/dist/util/expect/index.d.ts +39 -0
- package/dist/util/expect/index.js +145 -0
- package/dist/util/function.js__ +150 -0
- package/dist/util/index.d.ts +2 -0
- package/dist/util/index.js +2 -0
- package/dist/util/singleton/index.d.ts +34 -0
- package/dist/util/singleton/index.js +97 -0
- package/dist/util/svelte/index.d.ts +2 -0
- package/dist/util/svelte/index.js +2 -0
- package/dist/util/svelte/observe/index.d.ts +10 -0
- package/dist/util/svelte/observe/index.js +49 -0
- package/dist/util/svelte/state-context/index.d.ts +17 -0
- package/dist/util/svelte/state-context/index.js +83 -0
- package/dist/util/time.js__ +330 -0
- package/dist/valibot/index.d.ts +3 -0
- package/dist/valibot/index.js +30 -0
- package/dist/valibot/user.d.ts +6 -0
- package/dist/valibot/user.js +23 -0
- package/dist/zod/all.d.ts +6 -0
- package/dist/zod/all.js +33 -0
- package/dist/zod/generic.d.ts +6 -0
- package/dist/zod/generic.js +11 -0
- package/dist/zod/javascript.d.ts +8 -0
- package/dist/zod/javascript.js +32 -0
- package/dist/zod/user.d.ts +9 -0
- package/dist/zod/user.js +16 -0
- package/dist/zod/web.d.ts +21 -0
- package/dist/zod/web.js +57 -0
- package/package.json +144 -0
@@ -0,0 +1,86 @@
|
|
1
|
+
<script>
|
2
|
+
/**
|
3
|
+
* Icon component
|
4
|
+
*
|
5
|
+
* Source code adapted from
|
6
|
+
* @see https://github.com/steeze-ui/icons
|
7
|
+
*
|
8
|
+
*
|
9
|
+
* Install icons
|
10
|
+
* For icon packs @see https://github.com/steeze-ui/icons
|
11
|
+
*
|
12
|
+
* @eg install Hero Icons
|
13
|
+
*
|
14
|
+
* pnpm add -D @steeze-ui/heroicons
|
15
|
+
*/
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Properties
|
19
|
+
* ----------
|
20
|
+
* src - icon component
|
21
|
+
* size - width and height of the icon as percentage (..%) or in pixels
|
22
|
+
* theme - name of the icon set theme (e.g. 'solid' or 'outline')
|
23
|
+
*
|
24
|
+
* @type {{
|
25
|
+
* src: import('./types.js').IconSource,
|
26
|
+
* size?: string,
|
27
|
+
* theme?: string,
|
28
|
+
* base?: string,
|
29
|
+
* classes?: string
|
30
|
+
* } & { [attr: string]: * }}
|
31
|
+
*/
|
32
|
+
let {
|
33
|
+
src,
|
34
|
+
size = '100%',
|
35
|
+
theme = 'default',
|
36
|
+
base,
|
37
|
+
classes,
|
38
|
+
...attrs
|
39
|
+
} = $props();
|
40
|
+
|
41
|
+
/** @type {*} */
|
42
|
+
let icon = $state();
|
43
|
+
|
44
|
+
$effect(() => {
|
45
|
+
icon = src?.[theme] ?? src?.['default'] ?? Object.values(src)?.[0];
|
46
|
+
});
|
47
|
+
|
48
|
+
if (size !== '100%') {
|
49
|
+
if (size.slice(-1) !== '%') {
|
50
|
+
try {
|
51
|
+
size = parseInt(size, 10) + 'px';
|
52
|
+
} catch (error) {
|
53
|
+
size = '100%';
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
</script>
|
58
|
+
|
59
|
+
<svg
|
60
|
+
data-hk-icon
|
61
|
+
{...icon?.a}
|
62
|
+
xmlns="http://www.w3.org/2000/svg"
|
63
|
+
width={size}
|
64
|
+
height={size}
|
65
|
+
class="{base} {classes}"
|
66
|
+
{...attrs}
|
67
|
+
>
|
68
|
+
{#each icon?.path ?? [] as a}
|
69
|
+
<path {...a} />
|
70
|
+
{/each}
|
71
|
+
{#each icon?.rect ?? [] as a}
|
72
|
+
<rect {...a} />
|
73
|
+
{/each}
|
74
|
+
{#each icon?.circle ?? [] as a}
|
75
|
+
<circle {...a} />
|
76
|
+
{/each}
|
77
|
+
{#each icon?.polygon ?? [] as a}
|
78
|
+
<polygon {...a} />
|
79
|
+
{/each}
|
80
|
+
{#each icon?.polyline ?? [] as a}
|
81
|
+
<polyline {...a} />
|
82
|
+
{/each}
|
83
|
+
{#each icon?.line ?? [] as a}
|
84
|
+
<line {...a} />
|
85
|
+
{/each}
|
86
|
+
</svg>
|
@@ -0,0 +1,112 @@
|
|
1
|
+
<script>
|
2
|
+
/**
|
3
|
+
* TabBarIcon component
|
4
|
+
*
|
5
|
+
* Following component guidelines from Skeleton
|
6
|
+
* @see https://next.skeleton.dev/docs/resources/contribute/components
|
7
|
+
*/
|
8
|
+
|
9
|
+
// import { ElementRect } from 'runed';
|
10
|
+
|
11
|
+
import { onMount } from 'svelte';
|
12
|
+
|
13
|
+
import { HkGridArea } from '../area';
|
14
|
+
|
15
|
+
import HkIcon from './HkIcon.svelte';
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Properties
|
19
|
+
* ----------
|
20
|
+
* src - icon component
|
21
|
+
* theme - name of the icon set theme (e.g. 'solid' or 'outline')
|
22
|
+
* label - text of the label to place below the icon
|
23
|
+
*
|
24
|
+
* @type {{
|
25
|
+
* src: import('./typedef.js').IconSource,
|
26
|
+
* iconTheme?: string,
|
27
|
+
* label?: string,
|
28
|
+
* route?: string,
|
29
|
+
* active?: boolean,
|
30
|
+
* base?: string,
|
31
|
+
* bg?: string,
|
32
|
+
* padding?: string,
|
33
|
+
* margin?: string,
|
34
|
+
* classes?: string,
|
35
|
+
* iconClasses? : string,
|
36
|
+
* iconHeight?: string,
|
37
|
+
* labelClasses? : string,
|
38
|
+
* rect?: DOMRect,
|
39
|
+
* } & { [attr: string]: * }}
|
40
|
+
*
|
41
|
+
*
|
42
|
+
*/
|
43
|
+
let {
|
44
|
+
// Functional
|
45
|
+
src,
|
46
|
+
iconTheme,
|
47
|
+
label,
|
48
|
+
route,
|
49
|
+
|
50
|
+
active,
|
51
|
+
|
52
|
+
// Style
|
53
|
+
base,
|
54
|
+
bg,
|
55
|
+
padding,
|
56
|
+
margin,
|
57
|
+
classes,
|
58
|
+
iconClasses,
|
59
|
+
labelClasses,
|
60
|
+
|
61
|
+
// Event handlers
|
62
|
+
onmount,
|
63
|
+
|
64
|
+
// Rest attributes
|
65
|
+
...attrs
|
66
|
+
} = $props();
|
67
|
+
|
68
|
+
/** @type {HTMLElement} */
|
69
|
+
let iconBoxElem;
|
70
|
+
|
71
|
+
onMount(() => {
|
72
|
+
onmount(iconBoxElem);
|
73
|
+
});
|
74
|
+
</script>
|
75
|
+
|
76
|
+
{#snippet contents()}
|
77
|
+
<div data-hk--icon-box class="flex aspect-square w-full justify-center" bind:this={iconBoxElem}>
|
78
|
+
<HkIcon {src} size="100%" theme={iconTheme} classes={iconClasses} />
|
79
|
+
</div>
|
80
|
+
|
81
|
+
{#if label}
|
82
|
+
<div data-hk--label class="flex w-full justify-center {labelClasses}">
|
83
|
+
{label}
|
84
|
+
</div>
|
85
|
+
{/if}
|
86
|
+
{/snippet}
|
87
|
+
|
88
|
+
<HkGridArea
|
89
|
+
data-hk-tab-icon
|
90
|
+
boxMargin={margin}
|
91
|
+
boxPadding={padding}
|
92
|
+
base="grid-cols-1 justify-items-center cursor-pointer break-all overflow-clip h-full
|
93
|
+
{active ? 'active' : ''}
|
94
|
+
{label ? 'hasLabel' : ''} {base}"
|
95
|
+
{bg}
|
96
|
+
{...attrs}
|
97
|
+
>
|
98
|
+
{#if !route}
|
99
|
+
{@render contents()}
|
100
|
+
{:else}
|
101
|
+
<a href={route}>
|
102
|
+
{@render contents()}
|
103
|
+
</a>
|
104
|
+
{/if}
|
105
|
+
</HkGridArea>
|
106
|
+
|
107
|
+
<style>
|
108
|
+
a {
|
109
|
+
display: block;
|
110
|
+
text-decoration: none;
|
111
|
+
}
|
112
|
+
</style>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
export default HkTabIcon;
|
2
|
+
declare const HkTabIcon: import("svelte").Component<{
|
3
|
+
src: import("./typedef.js").IconSource;
|
4
|
+
iconTheme?: string;
|
5
|
+
label?: string;
|
6
|
+
route?: string;
|
7
|
+
active?: boolean;
|
8
|
+
base?: string;
|
9
|
+
bg?: string;
|
10
|
+
padding?: string;
|
11
|
+
margin?: string;
|
12
|
+
classes?: string;
|
13
|
+
iconClasses?: string;
|
14
|
+
iconHeight?: string;
|
15
|
+
labelClasses?: string;
|
16
|
+
rect?: DOMRect;
|
17
|
+
} & {
|
18
|
+
[attr: string]: any;
|
19
|
+
}, {}, "">;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
declare const _default: {};
|
2
|
+
export default _default;
|
3
|
+
export type AllowedTags = "path" | "circle" | "rect" | "polygon" | "polyline" | "line";
|
4
|
+
export type IconThemeSource = {
|
5
|
+
a: {
|
6
|
+
[attribute: string]: string;
|
7
|
+
};
|
8
|
+
} & { [tag in AllowedTags]?: {
|
9
|
+
[attribute: string]: string;
|
10
|
+
}[]; };
|
11
|
+
export type IconSource = {
|
12
|
+
[theme: string]: IconThemeSource;
|
13
|
+
};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/**
|
2
|
+
* @typedef {'path' | 'circle' | 'rect' | 'polygon' | 'polyline' | 'line'} AllowedTags
|
3
|
+
*/
|
4
|
+
|
5
|
+
/**
|
6
|
+
* @typedef { { a: { [attribute: string]: string }} &
|
7
|
+
* { [tag in AllowedTags]?: { [attribute: string]: string }[] }
|
8
|
+
* } IconThemeSource
|
9
|
+
*/
|
10
|
+
|
11
|
+
/**
|
12
|
+
* @typedef {{[theme: string]: IconThemeSource}} IconSource
|
13
|
+
*/
|
14
|
+
|
15
|
+
// Export default is required for exporting typedefs
|
16
|
+
export default {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,6 @@
|
|
1
|
+
export class AppLayoutState {
|
2
|
+
landscapeOnSmallScreen: boolean;
|
3
|
+
}
|
4
|
+
export const createOrGetState: (instanceKey?: string | Symbol) => AppLayoutState;
|
5
|
+
export const createState: (instanceKey?: string | Symbol) => AppLayoutState;
|
6
|
+
export const getState: (instanceKey?: string | Symbol) => AppLayoutState;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { defineStateContext } from '../../util/svelte/state-context';
|
2
|
+
|
3
|
+
import { browser } from '$app/environment';
|
4
|
+
|
5
|
+
import { MediaQuery } from 'runed';
|
6
|
+
|
7
|
+
/* ------------------------------------------------------- Define state class */
|
8
|
+
|
9
|
+
export class AppLayoutState {
|
10
|
+
landscapeOnSmallScreen = $state(false);
|
11
|
+
|
12
|
+
constructor() {
|
13
|
+
if (browser) {
|
14
|
+
let mq = new MediaQuery('(max-height: 400px');
|
15
|
+
|
16
|
+
$effect(() => {
|
17
|
+
this.landscapeOnSmallScreen = mq.matches ? true : false;
|
18
|
+
});
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
/* -------------------------------------- Export create & get state functions */
|
24
|
+
|
25
|
+
export const [createOrGetState, createState, getState] = defineStateContext(AppLayoutState);
|
@@ -0,0 +1,251 @@
|
|
1
|
+
<script>
|
2
|
+
/**
|
3
|
+
* @example
|
4
|
+
* // file.svelte
|
5
|
+
* <script>
|
6
|
+
* import AppLayout from '.../components/layout';
|
7
|
+
* <_/script>
|
8
|
+
*
|
9
|
+
* <AppLayout>
|
10
|
+
* {#snippet bgSnippet()}
|
11
|
+
* <BgGradient />
|
12
|
+
* {/snippet}
|
13
|
+
*
|
14
|
+
* {#snippet bottomSnippet()}
|
15
|
+
* <BottomBar />
|
16
|
+
* {/snippet}
|
17
|
+
*
|
18
|
+
* Main content
|
19
|
+
*
|
20
|
+
* </AppLayout>
|
21
|
+
*/
|
22
|
+
|
23
|
+
import { useResizeObserver } from '../../util/svelte/observe/index.js';
|
24
|
+
|
25
|
+
/**
|
26
|
+
* @typedef AppLayoutProps
|
27
|
+
*
|
28
|
+
* @property {import('svelte').Snippet|undefined} [bgPageSnippet]
|
29
|
+
* @property {import('svelte').Snippet|undefined} [bgSnippet]
|
30
|
+
* @property {import('svelte').Snippet|undefined} [topSnippet]
|
31
|
+
* @property {import('svelte').Snippet|undefined} [bottomSnippet]
|
32
|
+
* @property {import('svelte').Snippet} children
|
33
|
+
*/
|
34
|
+
|
35
|
+
/** @type {AppLayoutProps} */
|
36
|
+
let {
|
37
|
+
// > Functional
|
38
|
+
|
39
|
+
/** @type {boolean} */
|
40
|
+
// hasAuth = false,
|
41
|
+
|
42
|
+
bgPageSnippet,
|
43
|
+
bgSnippet,
|
44
|
+
|
45
|
+
topSnippet,
|
46
|
+
bottomSnippet,
|
47
|
+
|
48
|
+
children
|
49
|
+
|
50
|
+
// > Style
|
51
|
+
|
52
|
+
// base = '',
|
53
|
+
// bg = '',
|
54
|
+
// classes = '',
|
55
|
+
|
56
|
+
// > Background (child) styles
|
57
|
+
|
58
|
+
// > AppTop (child) styles
|
59
|
+
|
60
|
+
// appTopBase = '',
|
61
|
+
// appTopBg = '',
|
62
|
+
// appTopPadding = '',
|
63
|
+
// appTopMargin = '',
|
64
|
+
// appTopClasses = ''
|
65
|
+
} = $props();
|
66
|
+
|
67
|
+
// setAppLayoutContext({});
|
68
|
+
|
69
|
+
// Observe AppLayoutHeight
|
70
|
+
|
71
|
+
/** @type {HTMLElement|null} */
|
72
|
+
let elemAppLayout = $state(null);
|
73
|
+
let elemAppLayoutHeight = $state(0);
|
74
|
+
let elemAppLayoutWidth = $state(0);
|
75
|
+
|
76
|
+
useResizeObserver(
|
77
|
+
() => elemAppLayout,
|
78
|
+
(entries) => {
|
79
|
+
for (const { contentRect } of entries) {
|
80
|
+
// console.log('elemLayoutHeight', entry.contentRect.height);
|
81
|
+
elemAppLayoutHeight = contentRect.height;
|
82
|
+
elemAppLayoutWidth = contentRect.width;
|
83
|
+
break;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
);
|
87
|
+
|
88
|
+
// Observe layoutTopHeight
|
89
|
+
|
90
|
+
/** @type {HTMLElement|null} */
|
91
|
+
// let elemLayoutTop = $state(null);
|
92
|
+
// let elemLayoutTopHeight = $state(0);
|
93
|
+
|
94
|
+
// useResizeObserver(
|
95
|
+
// () => elemLayoutTop,
|
96
|
+
// (entries) => {
|
97
|
+
// for (const entry of entries) {
|
98
|
+
// console.log('elemLayoutTopHeight', entry.contentRect.height);
|
99
|
+
// elemLayoutTopHeight = entry.contentRect.height;
|
100
|
+
// break;
|
101
|
+
// }
|
102
|
+
// }
|
103
|
+
// );
|
104
|
+
|
105
|
+
// Observe layoutContentHeight
|
106
|
+
|
107
|
+
/** @type {HTMLElement|null} */
|
108
|
+
let elemLayoutContent = $state(null);
|
109
|
+
let elemLayoutContentHeight = $state(0);
|
110
|
+
|
111
|
+
useResizeObserver(
|
112
|
+
() => elemLayoutContent,
|
113
|
+
(entries) => {
|
114
|
+
for (const entry of entries) {
|
115
|
+
// console.log('elemLayoutHeight', entry.contentRect.height);
|
116
|
+
elemLayoutContentHeight = entry.contentRect.height;
|
117
|
+
break;
|
118
|
+
}
|
119
|
+
}
|
120
|
+
);
|
121
|
+
|
122
|
+
// Observe layoutBottomHeight
|
123
|
+
|
124
|
+
/** @type {HTMLElement|null} */
|
125
|
+
let elemLayoutBottom = $state(null);
|
126
|
+
|
127
|
+
let elemLayoutBottomHeight = $state(0);
|
128
|
+
|
129
|
+
useResizeObserver(
|
130
|
+
() => elemLayoutBottom,
|
131
|
+
(entries) => {
|
132
|
+
for (const entry of entries) {
|
133
|
+
// console.log('elemLayoutBottomRect', entry.contentRect);
|
134
|
+
elemLayoutBottomHeight = entry.contentRect.height;
|
135
|
+
break;
|
136
|
+
}
|
137
|
+
}
|
138
|
+
);
|
139
|
+
|
140
|
+
let contentMarginBottom = $derived(elemLayoutBottomHeight);
|
141
|
+
|
142
|
+
let innerWidth = $state(0);
|
143
|
+
let innerHeight = $state(0);
|
144
|
+
let outerHeight = $state(0);
|
145
|
+
</script>
|
146
|
+
|
147
|
+
<svelte:window bind:innerWidth bind:innerHeight bind:outerHeight />
|
148
|
+
|
149
|
+
<div data-layout-page-bg class="fixed z-0 h-screen w-screen">
|
150
|
+
{#if bgPageSnippet}
|
151
|
+
{@render bgPageSnippet()}
|
152
|
+
{/if}
|
153
|
+
</div>
|
154
|
+
|
155
|
+
<!-- <div
|
156
|
+
data-app-layout
|
157
|
+
class="g-no-select g-no-double-tab-zoom relative z-10 mx-auto grid min-h-lvh w-full grid-cols-[1fr] place-items-stretch border-8 border-green-500"
|
158
|
+
bind:this={elemAppLayout}
|
159
|
+
> -->
|
160
|
+
<div
|
161
|
+
data-app-layout
|
162
|
+
class="g-no-select g-no-double-tab-zoom relative z-10 mx-auto min-h-svh w-full"
|
163
|
+
bind:this={elemAppLayout}
|
164
|
+
>
|
165
|
+
<!-- BG (fixed)) -->
|
166
|
+
|
167
|
+
<div
|
168
|
+
data-layout-bg
|
169
|
+
class="relative bottom-0 z-20 h-svh w-full"
|
170
|
+
style:position={elemAppLayoutWidth ? 'fixed' : 'static'}
|
171
|
+
style:width={elemAppLayoutWidth ? `${elemAppLayoutWidth}px` : 'auto'}
|
172
|
+
>
|
173
|
+
{#if bgSnippet}
|
174
|
+
{@render bgSnippet()}
|
175
|
+
{/if}
|
176
|
+
</div>
|
177
|
+
|
178
|
+
<!-- FG (top, content) -->
|
179
|
+
|
180
|
+
<div data-layout-fg class="relative z-30 flex min-h-svh w-full flex-col">
|
181
|
+
<div data-layout-top class="relative z-40 w-full">
|
182
|
+
{#if topSnippet}
|
183
|
+
{@render topSnippet()}
|
184
|
+
{/if}
|
185
|
+
</div>
|
186
|
+
|
187
|
+
<div
|
188
|
+
data-layout-content
|
189
|
+
class="relative z-40 flex w-full grow flex-col"
|
190
|
+
bind:this={elemLayoutContent}
|
191
|
+
style:margin-bottom={`${contentMarginBottom}px`}
|
192
|
+
>
|
193
|
+
<!-- <div class="border text-white">
|
194
|
+
Top height: [{elemLayoutTopHeight}]<br />
|
195
|
+
Content height: [{elemLayoutContentHeight}]<br />
|
196
|
+
Bottom height: [{elemLayoutBottomHeight}]<br />
|
197
|
+
App Layout height: [{elemAppLayoutHeight}]<br />
|
198
|
+
Content margin bottom [{contentMarginBottom}]<br />
|
199
|
+
innerWidth [{innerWidth}]<br />
|
200
|
+
innerHeight [{innerHeight}]
|
201
|
+
</div> -->
|
202
|
+
<!-- -webkit-font-smoothing: antialiased; -->
|
203
|
+
{@render children()}
|
204
|
+
</div>
|
205
|
+
</div>
|
206
|
+
|
207
|
+
<!-- Bottom (fixed) -->
|
208
|
+
|
209
|
+
<div
|
210
|
+
data-layout-bottom
|
211
|
+
bind:this={elemLayoutBottom}
|
212
|
+
class="bottom-0 z-50 mx-auto"
|
213
|
+
style:position={elemAppLayoutWidth ? 'fixed' : 'static'}
|
214
|
+
style:width={elemAppLayoutWidth ? `${elemAppLayoutWidth}px` : 'auto'}
|
215
|
+
>
|
216
|
+
{#if bottomSnippet}
|
217
|
+
{@render bottomSnippet()}
|
218
|
+
{/if}
|
219
|
+
|
220
|
+
<!-- <AppBottom
|
221
|
+
base={appTopBase}
|
222
|
+
bg={appTopBg}
|
223
|
+
padding={appTopPadding}
|
224
|
+
margin={appTopMargin}
|
225
|
+
classes={appTopClasses}
|
226
|
+
/> -->
|
227
|
+
</div>
|
228
|
+
</div>
|
229
|
+
|
230
|
+
<style>
|
231
|
+
[data-layout-page-bg] {
|
232
|
+
overflow: hidden;
|
233
|
+
}
|
234
|
+
|
235
|
+
[data-layout-bg] {
|
236
|
+
grid-area: 1 / 1 / 2 / 2; /* row-start, col-start, row-end, col-end */
|
237
|
+
overflow: hidden;
|
238
|
+
}
|
239
|
+
|
240
|
+
[data-layout-fg] {
|
241
|
+
grid-area: 1 / 1 / 2 / 2; /* row-start, col-start, row-end, col-end */
|
242
|
+
}
|
243
|
+
|
244
|
+
:global(html:not(.no-scrollbar-shift-fix)) {
|
245
|
+
/*
|
246
|
+
* Shift contents of page to the left when scrollbar appears,
|
247
|
+
* so content like tab bars stay centered
|
248
|
+
*/
|
249
|
+
padding-left: calc(100vw - 100%);
|
250
|
+
}
|
251
|
+
</style>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export default HkAppLayout;
|
2
|
+
declare const HkAppLayout: import("svelte").Component<{
|
3
|
+
bgPageSnippet?: import("svelte").Snippet | undefined;
|
4
|
+
bgSnippet?: import("svelte").Snippet | undefined;
|
5
|
+
topSnippet?: import("svelte").Snippet | undefined;
|
6
|
+
bottomSnippet?: import("svelte").Snippet | undefined;
|
7
|
+
children: import("svelte").Snippet;
|
8
|
+
}, {}, "">;
|
@@ -0,0 +1,72 @@
|
|
1
|
+
<script>
|
2
|
+
/**
|
3
|
+
* Grid Layers component
|
4
|
+
* This is a grid with only one cell. All direct children are
|
5
|
+
* place in the same cell and form a visually stacked component.
|
6
|
+
*
|
7
|
+
* This can be used to place e.g. texts over an image. Place the
|
8
|
+
* image in a layer and the text in another. The standard grid
|
9
|
+
* content placement options can be used.
|
10
|
+
*
|
11
|
+
* Following component guidelines from Skeleton
|
12
|
+
* @see https://next.skeleton.dev/docs/resources/contribute/components
|
13
|
+
*/
|
14
|
+
|
15
|
+
/**
|
16
|
+
* @type {{
|
17
|
+
* base?: string,
|
18
|
+
* bg?: string,
|
19
|
+
* padding?: string,
|
20
|
+
* margin?: string,
|
21
|
+
* classes?: string,
|
22
|
+
* style?: string,
|
23
|
+
* boxBase?: string,
|
24
|
+
* boxBg?: string,
|
25
|
+
* boxPadding?: string,
|
26
|
+
* boxMargin?: string,
|
27
|
+
* boxClasses?: string,
|
28
|
+
* boxAttrs?: { [attr: string]: * },
|
29
|
+
* children: import('svelte').Snippet
|
30
|
+
* } & { [attr: string]: * }}
|
31
|
+
*/
|
32
|
+
const {
|
33
|
+
// Style
|
34
|
+
base,
|
35
|
+
bg,
|
36
|
+
padding,
|
37
|
+
margin,
|
38
|
+
classes,
|
39
|
+
style,
|
40
|
+
boxBase,
|
41
|
+
boxBg,
|
42
|
+
boxPadding,
|
43
|
+
boxMargin,
|
44
|
+
boxClasses,
|
45
|
+
|
46
|
+
// Snippets
|
47
|
+
children,
|
48
|
+
|
49
|
+
// Attributes
|
50
|
+
...attrs
|
51
|
+
} = $props();
|
52
|
+
</script>
|
53
|
+
|
54
|
+
<div
|
55
|
+
data-hk-grid-layers-box
|
56
|
+
class="{boxBase} {boxBg} {boxPadding} {boxMargin} {boxClasses}"
|
57
|
+
{...attrs}
|
58
|
+
>
|
59
|
+
<div
|
60
|
+
data-hk-grid-layers
|
61
|
+
class="grid grid-cols-1 grid-rows-1 {base} {bg} {classes} {margin}"
|
62
|
+
{style}
|
63
|
+
>
|
64
|
+
{@render children()}
|
65
|
+
</div>
|
66
|
+
</div>
|
67
|
+
|
68
|
+
<style>
|
69
|
+
[data-hk-grid-layers] > :global(*) {
|
70
|
+
grid-area: 1/1/2/2;
|
71
|
+
}
|
72
|
+
</style>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
export default HkGridLayers;
|
2
|
+
declare const HkGridLayers: import("svelte").Component<{
|
3
|
+
base?: string;
|
4
|
+
bg?: string;
|
5
|
+
padding?: string;
|
6
|
+
margin?: string;
|
7
|
+
classes?: string;
|
8
|
+
style?: string;
|
9
|
+
boxBase?: string;
|
10
|
+
boxBg?: string;
|
11
|
+
boxPadding?: string;
|
12
|
+
boxMargin?: string;
|
13
|
+
boxClasses?: string;
|
14
|
+
boxAttrs?: {
|
15
|
+
[attr: string]: any;
|
16
|
+
};
|
17
|
+
children: import("svelte").Snippet;
|
18
|
+
} & {
|
19
|
+
[attr: string]: any;
|
20
|
+
}, {}, "">;
|
@@ -0,0 +1,3 @@
|
|
1
|
+
export { default as HkAppLayout } from "./HkAppLayout.svelte";
|
2
|
+
export { default as HkGridLayers } from "./HkGridLayers.svelte";
|
3
|
+
export { createOrGetState as createOrGetAppLayoutState, createState as createAppLayoutState, getState as getAppLayoutState } from "./HkAppLayout.state.svelte.js";
|
@@ -0,0 +1,9 @@
|
|
1
|
+
export {
|
2
|
+
createOrGetState as createOrGetAppLayoutState,
|
3
|
+
createState as createAppLayoutState,
|
4
|
+
getState as getAppLayoutState
|
5
|
+
} from './HkAppLayout.state.svelte.js';
|
6
|
+
|
7
|
+
export { default as HkAppLayout } from './HkAppLayout.svelte';
|
8
|
+
|
9
|
+
export { default as HkGridLayers } from './HkGridLayers.svelte';
|