mountain-ui 1.0.170 → 1.0.172
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 +1 -1
- package/src/lib/registry/navigationRegistry/components/Navbar.svelte +1 -3
- package/src/lib/registry/projectRegistry/createProject.js +2 -0
- package/src/lib/registry/webComponentRegistry/components/WebComponent.svelte +27 -0
- package/src/lib/registry/webComponentRegistry/createWebComponent.js +619 -0
- package/src/lib/registry/webComponentRegistry/registerWebComponents.js +12 -0
- package/src/lib/registry/webComponentRegistry/registry.svelte.js +64 -0
- package/src/lib/registry/webComponentTypeRegistry/components/WebComponentType.svelte +18 -0
- package/src/lib/registry/webComponentTypeRegistry/createWebComponentType.js +59 -0
- package/src/lib/registry/webComponentTypeRegistry/registerWebComponentTypes.js +12 -0
- package/src/lib/registry/webComponentTypeRegistry/registry.svelte.js +42 -0
- package/src/lib/registry/webComponentTypeRegistry/webComponentTypes/Frame/Frame.svelte +7 -0
- package/src/lib/registry/webComponentTypeRegistry/webComponentTypes/Frame/index.js +52 -0
- package/src/lib/registry/webComponentTypeRegistry/webComponentTypes/Page/Page.svelte +259 -0
- package/src/lib/registry/webComponentTypeRegistry/webComponentTypes/Page/index.js +52 -0
- package/src/lib/registry/webPageRegistry/components/WebPage.svelte +14 -0
- package/src/lib/registry/webPageRegistry/createWebPage.js +22 -0
- package/src/lib/registry/webPageRegistry/registerWebPage.js +9 -0
- package/src/lib/registry/webPageRegistry/registry.svelte.js +106 -0
- package/src/lib/registry/webSite/components/Editor.svelte +11 -0
- package/src/lib/registry/webSite/createWebComponentType.js +13 -0
- package/src/lib/registry/webSite/registerWebComponentTypes.js +12 -0
- package/src/lib/registry/webSite/registry.svelte.js +42 -0
- package/src/routes/exemple/[project_normalized_name]/site-builder/+page.svelte +391 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { writable, derived, get } from 'svelte/store';
|
|
2
|
+
|
|
3
|
+
function createWebComponentRegistry() {
|
|
4
|
+
const store = writable({});
|
|
5
|
+
|
|
6
|
+
const targetWebComponentId = writable(null);
|
|
7
|
+
|
|
8
|
+
const all = derived(store, ($webComponents) => Object.values($webComponents));
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
subscribe: store.subscribe,
|
|
12
|
+
|
|
13
|
+
register(webComponent) {
|
|
14
|
+
store.update((webComponents) => ({
|
|
15
|
+
...webComponents,
|
|
16
|
+
[webComponent.id]: webComponent
|
|
17
|
+
}));
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
unregister(id) {
|
|
21
|
+
store.update((webComponents) => {
|
|
22
|
+
const copy = { ...webComponents };
|
|
23
|
+
|
|
24
|
+
delete copy[id];
|
|
25
|
+
|
|
26
|
+
return copy;
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
get(id) {
|
|
31
|
+
return get(store)[id];
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
select(id) {
|
|
35
|
+
return derived(store, ($webComponents) => $webComponents[id]);
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
getAll() {
|
|
39
|
+
return all;
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
setActive(webComponentId) {
|
|
43
|
+
console.log(webComponentId);
|
|
44
|
+
|
|
45
|
+
targetWebComponentId.set(webComponentId)
|
|
46
|
+
},
|
|
47
|
+
unsetActive() {
|
|
48
|
+
targetWebComponentId.set(null)
|
|
49
|
+
},
|
|
50
|
+
getActive() {
|
|
51
|
+
return derived(
|
|
52
|
+
[targetWebComponentId, store],
|
|
53
|
+
([$targetWebComponentId, $webComponents]) =>
|
|
54
|
+
$targetWebComponentId ? $webComponents[$targetWebComponentId] : null
|
|
55
|
+
);
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
update(){
|
|
59
|
+
store.update(s=>s)
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const webComponentRegistry = createWebComponentRegistry();
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { webComponentTypeRegistry } from "../registry.svelte";
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
type,
|
|
6
|
+
...props
|
|
7
|
+
} = $props()
|
|
8
|
+
|
|
9
|
+
const webComponentType = $derived(webComponentTypeRegistry.get(type))
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
{#if webComponentType}
|
|
13
|
+
<svelte:component this={webComponentType.component} {...props}>
|
|
14
|
+
<slot/>
|
|
15
|
+
</svelte:component>
|
|
16
|
+
{/if}
|
|
17
|
+
|
|
18
|
+
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { sendRequest } from "hamzus-ui";
|
|
2
|
+
import { webComponentTypeRegistry } from "./registry.svelte";
|
|
3
|
+
import { get } from "svelte/store";
|
|
4
|
+
|
|
5
|
+
export function createWebComponentType(config = {}) {
|
|
6
|
+
const webComponentType = {
|
|
7
|
+
type: "",
|
|
8
|
+
component: null,
|
|
9
|
+
allowChild: false,
|
|
10
|
+
allowDelete: false,
|
|
11
|
+
allowBreakpoint: false,
|
|
12
|
+
allowScrollSection: false,
|
|
13
|
+
allowLayout: { // {} | false
|
|
14
|
+
// type
|
|
15
|
+
allowGrid: true,
|
|
16
|
+
allowStack: true,
|
|
17
|
+
// distribute
|
|
18
|
+
allowedDistribution: ["start", "center", "end", "space-between", "space-around", "space-evenly"], // [] | false
|
|
19
|
+
// align
|
|
20
|
+
allowedAlignement: ["start", "center", "end"], // [] | false
|
|
21
|
+
// wrap
|
|
22
|
+
allowWrap: true,
|
|
23
|
+
// gap
|
|
24
|
+
allowGap: true,
|
|
25
|
+
// padding
|
|
26
|
+
allowPadding: true,
|
|
27
|
+
},
|
|
28
|
+
// typography
|
|
29
|
+
allowTypography: true,
|
|
30
|
+
// overlay
|
|
31
|
+
allowedOverlay: ["fixed", "relative"], // [] | false
|
|
32
|
+
// styles
|
|
33
|
+
allowStyle: { // {} | false
|
|
34
|
+
allowOpacity: false,
|
|
35
|
+
allowVisibility: false,
|
|
36
|
+
allowFill: false,
|
|
37
|
+
allowOverflow: false,
|
|
38
|
+
allowRadius: false,
|
|
39
|
+
allowBorder: false,
|
|
40
|
+
allowZIndex: false,
|
|
41
|
+
},
|
|
42
|
+
// link
|
|
43
|
+
allowLink: false,
|
|
44
|
+
// position
|
|
45
|
+
allowedPosition: ["absolute", "relative", "fixed", "sticky"], // [] | false
|
|
46
|
+
// size
|
|
47
|
+
allowSize: { // {} | false
|
|
48
|
+
allowedWidth: ["relative", "fill", "fixed", "fit-content", "viewport"],
|
|
49
|
+
allowedHeight: ["relative", "fill", "fixed", "fit-content", "viewport"],
|
|
50
|
+
allowMinMaxWidth: false,
|
|
51
|
+
allowMinMaxHeight: false,
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
Object.assign(webComponentType, config);
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
return webComponentType;
|
|
59
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { sendRequest } from "hamzus-ui";
|
|
2
|
+
import { webComponentTypeRegistry } from "./registry.svelte";
|
|
3
|
+
import { createWebComponentType } from "./createWebComponentType.js";
|
|
4
|
+
|
|
5
|
+
import Page from "./webComponentTypes/Page/index.js";
|
|
6
|
+
import Frame from "./webComponentTypes/Frame/index.js";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export async function registerWebComponentTypes() {
|
|
10
|
+
webComponentTypeRegistry.register(Page)
|
|
11
|
+
webComponentTypeRegistry.register(Frame)
|
|
12
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { writable, derived, get } from 'svelte/store';
|
|
2
|
+
|
|
3
|
+
function createWebComponentTypeRegistry() {
|
|
4
|
+
const store = writable({});
|
|
5
|
+
|
|
6
|
+
const all = derived(store, ($webComponentTypes) => Object.values($webComponentTypes));
|
|
7
|
+
|
|
8
|
+
return {
|
|
9
|
+
subscribe: store.subscribe,
|
|
10
|
+
|
|
11
|
+
register(webComponentType) {
|
|
12
|
+
store.update((webComponentTypes) => ({
|
|
13
|
+
...webComponentTypes,
|
|
14
|
+
[webComponentType.type]: webComponentType
|
|
15
|
+
}));
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
unregister(type) {
|
|
19
|
+
store.update((webComponentTypes) => {
|
|
20
|
+
const copy = { ...webComponentTypes };
|
|
21
|
+
|
|
22
|
+
delete copy[type];
|
|
23
|
+
|
|
24
|
+
return copy;
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
get(type) {
|
|
29
|
+
return get(store)[type];
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
select(type) {
|
|
33
|
+
return derived(store, ($webComponentTypes) => $webComponentTypes[type]);
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
getAll() {
|
|
37
|
+
return all;
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const webComponentTypeRegistry = createWebComponentTypeRegistry();
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { createWebComponentType } from "../../createWebComponentType.js";
|
|
2
|
+
|
|
3
|
+
import Frame from "./Frame.svelte"
|
|
4
|
+
|
|
5
|
+
export default createWebComponentType({
|
|
6
|
+
type: "frame",
|
|
7
|
+
component: Frame,
|
|
8
|
+
allowChild: true,
|
|
9
|
+
allowDelete: true,
|
|
10
|
+
allowBreakpoint: false,
|
|
11
|
+
allowScrollSection: true,
|
|
12
|
+
allowLayout: { // {} | false
|
|
13
|
+
// type
|
|
14
|
+
allowGrid: true,
|
|
15
|
+
allowStack: true,
|
|
16
|
+
// distribute
|
|
17
|
+
allowedDistribution: ["start", "center", "end", "space-between", "space-around", "space-evenly"], // [] | false
|
|
18
|
+
// align
|
|
19
|
+
allowedAlignement: ["start", "center", "end"], // [] | false
|
|
20
|
+
// wrap
|
|
21
|
+
allowWrap: true,
|
|
22
|
+
// gap
|
|
23
|
+
allowGap: true,
|
|
24
|
+
// padding
|
|
25
|
+
allowPadding: true,
|
|
26
|
+
},
|
|
27
|
+
// typography
|
|
28
|
+
allowTypography: false,
|
|
29
|
+
// overlay
|
|
30
|
+
allowedOverlay: ["fixed", "relative"], // [] | false
|
|
31
|
+
// styles
|
|
32
|
+
allowStyle: { // {} | false
|
|
33
|
+
allowOpacity: true,
|
|
34
|
+
allowVisibility: true,
|
|
35
|
+
allowFill: true,
|
|
36
|
+
allowOverflow: true,
|
|
37
|
+
allowRadius: true,
|
|
38
|
+
allowBorder: true,
|
|
39
|
+
allowZIndex: true,
|
|
40
|
+
},
|
|
41
|
+
// link
|
|
42
|
+
allowLink: true,
|
|
43
|
+
// position
|
|
44
|
+
allowedPosition: ["absolute", "relative", "fixed", "sticky"], // [] | false
|
|
45
|
+
// size
|
|
46
|
+
allowSize: { // {} | false
|
|
47
|
+
allowedWidth: ["relative", "fill", "fixed", "fit-content", "viewport"],
|
|
48
|
+
allowedHeight: ["relative", "fill", "fixed", "fit-content", "viewport"],
|
|
49
|
+
allowMinMaxWidth: true,
|
|
50
|
+
allowMinMaxHeight: true,
|
|
51
|
+
}
|
|
52
|
+
})
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { createWebComponent } from '$lib/registry/webComponentRegistry/createWebComponent';
|
|
3
|
+
import { webComponentRegistry } from '$lib/registry/webComponentRegistry/registry.svelte';
|
|
4
|
+
import { webPageRegistry } from '$lib/registry/webPageRegistry/registry.svelte';
|
|
5
|
+
import { Button, DropdownMenu, IconButton, Input } from 'hamzus-ui';
|
|
6
|
+
|
|
7
|
+
let { webComponentId, webPagePath, children } = $props();
|
|
8
|
+
|
|
9
|
+
const webComponent = $derived(webComponentRegistry.select(webComponentId));
|
|
10
|
+
const webPage = $derived(webPageRegistry.select(webPagePath));
|
|
11
|
+
const css = $derived($webComponent?.getCSS())
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
function handleAdd() {
|
|
15
|
+
webPageRegistry.addChildTo(
|
|
16
|
+
$webPage.path,
|
|
17
|
+
webComponentId,
|
|
18
|
+
createWebComponent({
|
|
19
|
+
id: null,
|
|
20
|
+
type: 'frame',
|
|
21
|
+
path: [],
|
|
22
|
+
children: [],
|
|
23
|
+
breakPoints: [],
|
|
24
|
+
scrollSection: {
|
|
25
|
+
enable: false,
|
|
26
|
+
name: '',
|
|
27
|
+
offsetY: 0
|
|
28
|
+
},
|
|
29
|
+
layout: {
|
|
30
|
+
type: 'stack', // stack | grid | null
|
|
31
|
+
stack: {
|
|
32
|
+
direction: 'row', // row | column
|
|
33
|
+
distribution: 'start',
|
|
34
|
+
alignement: 'start',
|
|
35
|
+
wrap: false
|
|
36
|
+
},
|
|
37
|
+
grid: {
|
|
38
|
+
type: 'fixed', // fixed | auto
|
|
39
|
+
col: 2,
|
|
40
|
+
rows: 2
|
|
41
|
+
},
|
|
42
|
+
gap: {
|
|
43
|
+
x: 0,
|
|
44
|
+
y: 0
|
|
45
|
+
},
|
|
46
|
+
padding: {
|
|
47
|
+
top: 0,
|
|
48
|
+
right: 0,
|
|
49
|
+
bottom: 0,
|
|
50
|
+
left: 0
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
typography: {
|
|
54
|
+
content: 'exemple',
|
|
55
|
+
weigth: 'Regular', // thin | thin-italic | extra-light | extra-light-italic | light | light-italic | regular | italic | medium | medium-italic | semi-bold | semi-bold-italic | bold | bold-italic | extra-bold | extra-bold-italic | black | black-italic
|
|
56
|
+
fontSize: 16,
|
|
57
|
+
fontSizeType: 'px', // px | rem
|
|
58
|
+
letterSpacing: 0,
|
|
59
|
+
lineHeight: 16,
|
|
60
|
+
alignement: 'left', // left | center | right | justify
|
|
61
|
+
tag: 'p' // left | center | right | justify
|
|
62
|
+
},
|
|
63
|
+
// overlay
|
|
64
|
+
overlay: [],
|
|
65
|
+
// styles
|
|
66
|
+
style: {
|
|
67
|
+
opacity: 1,
|
|
68
|
+
visibilty: true,
|
|
69
|
+
fill: {
|
|
70
|
+
r: 0,
|
|
71
|
+
g: 0,
|
|
72
|
+
b: 0,
|
|
73
|
+
a: 1
|
|
74
|
+
},
|
|
75
|
+
overflow: 'visible', // visible | clip | hidden | scroll
|
|
76
|
+
borderRadius: {
|
|
77
|
+
tl: 0,
|
|
78
|
+
tr: 0,
|
|
79
|
+
br: 0,
|
|
80
|
+
bl: 0
|
|
81
|
+
},
|
|
82
|
+
border: {
|
|
83
|
+
r: 0,
|
|
84
|
+
g: 0,
|
|
85
|
+
b: 0,
|
|
86
|
+
a: 1
|
|
87
|
+
},
|
|
88
|
+
ZIndex: 1
|
|
89
|
+
},
|
|
90
|
+
// link
|
|
91
|
+
link: {
|
|
92
|
+
enable: false,
|
|
93
|
+
href: '',
|
|
94
|
+
newTab: true
|
|
95
|
+
},
|
|
96
|
+
// position
|
|
97
|
+
position: {
|
|
98
|
+
type: 'relative', // absolute | relative | fixed | sticky
|
|
99
|
+
absolute: {
|
|
100
|
+
top: null,
|
|
101
|
+
left: null,
|
|
102
|
+
right: null,
|
|
103
|
+
bottom: null
|
|
104
|
+
},
|
|
105
|
+
fixed: {
|
|
106
|
+
top: null,
|
|
107
|
+
left: null,
|
|
108
|
+
right: null,
|
|
109
|
+
bottom: null
|
|
110
|
+
},
|
|
111
|
+
sticky: {
|
|
112
|
+
top: 0
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
// size
|
|
116
|
+
size: {
|
|
117
|
+
widthType: 'relative', // relative | fill | fixed | fit-content | viewport
|
|
118
|
+
width: 100,
|
|
119
|
+
heightType: 'relative', // relative | fill | fixed | fit-content | viewport
|
|
120
|
+
height: 100,
|
|
121
|
+
minWidthType: 'relative', // relative | fill | fixed | fit-content | viewport
|
|
122
|
+
minWidth: null,
|
|
123
|
+
maxWidthType: 'relative', // relative | fill | fixed | fit-content | viewport
|
|
124
|
+
maxWidth: null,
|
|
125
|
+
minHeightType: 'relative', // relative | fill | fixed | fit-content | viewport
|
|
126
|
+
minHeight: null,
|
|
127
|
+
maxHeightType: 'relative', // relative | fill | fixed | fit-content | viewport
|
|
128
|
+
maxHeight: null
|
|
129
|
+
}
|
|
130
|
+
})
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
let newBreakPointName = $state('');
|
|
135
|
+
let newBreakPointWidth = $state('');
|
|
136
|
+
|
|
137
|
+
function handleAddBreakPoint() {
|
|
138
|
+
$webComponent.addBreakpoint(newBreakPointName, parseInt(newBreakPointWidth));
|
|
139
|
+
$webPage.update();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function handleDeleteBreakPoint(name) {
|
|
143
|
+
$webComponent.deleteBreakpoint(name);
|
|
144
|
+
$webPage.update();
|
|
145
|
+
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function handleClick(e) {
|
|
149
|
+
e.stopPropagation()
|
|
150
|
+
console.log(webComponentId);
|
|
151
|
+
|
|
152
|
+
webComponentRegistry.setActive(webComponentId)
|
|
153
|
+
$webPage.update();
|
|
154
|
+
}
|
|
155
|
+
</script>
|
|
156
|
+
|
|
157
|
+
{#if $webComponent}
|
|
158
|
+
{#each $webComponent.breakPoints as breakPoint}
|
|
159
|
+
<div class="page-container" onclick={handleClick}>
|
|
160
|
+
<div class="breakpoint">
|
|
161
|
+
<h4 style="color: color:var(--font-1); font-size:calc(var(--text-4) * var(--zoom)); line-height:calc(var(--text-4) * var(--zoom));">
|
|
162
|
+
{breakPoint.name}
|
|
163
|
+
<span style="color:var(--font-2);">{breakPoint.width}px</span>
|
|
164
|
+
</h4>
|
|
165
|
+
|
|
166
|
+
<div class="right">
|
|
167
|
+
<DropdownMenu.Root
|
|
168
|
+
onOpen={() => {
|
|
169
|
+
newBreakPointName = '';
|
|
170
|
+
newBreakPointWidth = '';
|
|
171
|
+
}}
|
|
172
|
+
direction="bottom"
|
|
173
|
+
>
|
|
174
|
+
<DropdownMenu.Trigger slot="trigger">
|
|
175
|
+
<IconButton variant="secondary" size="calc(24px * var(--zoom))">
|
|
176
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
177
|
+
<path d="M18 12.75H6C5.59 12.75 5.25 12.41 5.25 12C5.25 11.59 5.59 11.25 6 11.25H18C18.41 11.25 18.75 11.59 18.75 12C18.75 12.41 18.41 12.75 18 12.75Z" fill="#292D32"/>
|
|
178
|
+
<path d="M12 18.75C11.59 18.75 11.25 18.41 11.25 18V6C11.25 5.59 11.59 5.25 12 5.25C12.41 5.25 12.75 5.59 12.75 6V18C12.75 18.41 12.41 18.75 12 18.75Z" fill="#292D32"/>
|
|
179
|
+
</svg>
|
|
180
|
+
|
|
181
|
+
</IconButton>
|
|
182
|
+
</DropdownMenu.Trigger>
|
|
183
|
+
<DropdownMenu.Content slot="content" width="250px">
|
|
184
|
+
<Input bind:value={newBreakPointName} label="nom" placeholder="nom" />
|
|
185
|
+
<Input
|
|
186
|
+
bind:value={newBreakPointWidth}
|
|
187
|
+
type="number"
|
|
188
|
+
step="1"
|
|
189
|
+
label="taille"
|
|
190
|
+
placeholder="1000"
|
|
191
|
+
>
|
|
192
|
+
<h6 slot="endContent">px</h6>
|
|
193
|
+
</Input>
|
|
194
|
+
<Button onClick={handleAddBreakPoint} style="width:100%" variant="secondary">
|
|
195
|
+
<h5>Ajouter</h5>
|
|
196
|
+
</Button>
|
|
197
|
+
</DropdownMenu.Content>
|
|
198
|
+
</DropdownMenu.Root>
|
|
199
|
+
<IconButton
|
|
200
|
+
variant="destructive"
|
|
201
|
+
onClick={() => {
|
|
202
|
+
handleDeleteBreakPoint(breakPoint.name);
|
|
203
|
+
}}
|
|
204
|
+
size="calc(24px * var(--zoom))"
|
|
205
|
+
>
|
|
206
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
207
|
+
<path d="M20.9997 6.72998C20.9797 6.72998 20.9497 6.72998 20.9197 6.72998C15.6297 6.19998 10.3497 5.99998 5.11967 6.52998L3.07967 6.72998C2.65967 6.76998 2.28967 6.46998 2.24967 6.04998C2.20967 5.62998 2.50967 5.26998 2.91967 5.22998L4.95967 5.02998C10.2797 4.48998 15.6697 4.69998 21.0697 5.22998C21.4797 5.26998 21.7797 5.63998 21.7397 6.04998C21.7097 6.43998 21.3797 6.72998 20.9997 6.72998Z" fill="#292D32"/>
|
|
208
|
+
<path d="M8.50074 5.72C8.46074 5.72 8.42074 5.72 8.37074 5.71C7.97074 5.64 7.69074 5.25 7.76074 4.85L7.98074 3.54C8.14074 2.58 8.36074 1.25 10.6907 1.25H13.3107C15.6507 1.25 15.8707 2.63 16.0207 3.55L16.2407 4.85C16.3107 5.26 16.0307 5.65 15.6307 5.71C15.2207 5.78 14.8307 5.5 14.7707 5.1L14.5507 3.8C14.4107 2.93 14.3807 2.76 13.3207 2.76H10.7007C9.64074 2.76 9.62074 2.9 9.47074 3.79L9.24074 5.09C9.18074 5.46 8.86074 5.72 8.50074 5.72Z" fill="#292D32"/>
|
|
209
|
+
<path d="M15.2104 22.7501H8.79039C5.30039 22.7501 5.16039 20.8201 5.05039 19.2601L4.40039 9.19007C4.37039 8.78007 4.69039 8.42008 5.10039 8.39008C5.52039 8.37008 5.87039 8.68008 5.90039 9.09008L6.55039 19.1601C6.66039 20.6801 6.70039 21.2501 8.79039 21.2501H15.2104C17.3104 21.2501 17.3504 20.6801 17.4504 19.1601L18.1004 9.09008C18.1304 8.68008 18.4904 8.37008 18.9004 8.39008C19.3104 8.42008 19.6304 8.77007 19.6004 9.19007L18.9504 19.2601C18.8404 20.8201 18.7004 22.7501 15.2104 22.7501Z" fill="#292D32"/>
|
|
210
|
+
<path d="M13.6601 17.25H10.3301C9.92008 17.25 9.58008 16.91 9.58008 16.5C9.58008 16.09 9.92008 15.75 10.3301 15.75H13.6601C14.0701 15.75 14.4101 16.09 14.4101 16.5C14.4101 16.91 14.0701 17.25 13.6601 17.25Z" fill="#292D32"/>
|
|
211
|
+
<path d="M14.5 13.25H9.5C9.09 13.25 8.75 12.91 8.75 12.5C8.75 12.09 9.09 11.75 9.5 11.75H14.5C14.91 11.75 15.25 12.09 15.25 12.5C15.25 12.91 14.91 13.25 14.5 13.25Z" fill="#292D32"/>
|
|
212
|
+
</svg>
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
</IconButton>
|
|
216
|
+
</div>
|
|
217
|
+
</div>
|
|
218
|
+
<div
|
|
219
|
+
class="page"
|
|
220
|
+
style="
|
|
221
|
+
--width:{breakPoint.width}px;
|
|
222
|
+
{$css}
|
|
223
|
+
"
|
|
224
|
+
>
|
|
225
|
+
<slot />
|
|
226
|
+
</div>
|
|
227
|
+
</div>
|
|
228
|
+
{/each}
|
|
229
|
+
{/if}
|
|
230
|
+
|
|
231
|
+
<style>
|
|
232
|
+
.page-container {
|
|
233
|
+
display: flex;
|
|
234
|
+
flex-direction: column;
|
|
235
|
+
row-gap: calc(var(--pad-m) * var(--zoom));
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.breakpoint {
|
|
239
|
+
display: flex;
|
|
240
|
+
align-items: center;
|
|
241
|
+
justify-content: space-between;
|
|
242
|
+
padding: calc(var(--pad-s) * var(--zoom));
|
|
243
|
+
border-radius: var(--radius-m);
|
|
244
|
+
background-color: var(--bg-2);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.right {
|
|
248
|
+
display: flex;
|
|
249
|
+
align-items: center;
|
|
250
|
+
column-gap: var(--pad-s);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.page {
|
|
254
|
+
width: calc(var(--width) * var(--zoom));
|
|
255
|
+
height: calc(100px * var(--zoom));
|
|
256
|
+
border: 2px solid var(--bg-2);
|
|
257
|
+
background-color: var(--bg-1);
|
|
258
|
+
}
|
|
259
|
+
</style>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { createWebComponentType } from "../../createWebComponentType.js";
|
|
2
|
+
|
|
3
|
+
import Page from "./Page.svelte";
|
|
4
|
+
|
|
5
|
+
export default createWebComponentType({
|
|
6
|
+
type: "page",
|
|
7
|
+
component: Page,
|
|
8
|
+
allowChild: true,
|
|
9
|
+
allowDelete: false,
|
|
10
|
+
allowBreakpoint: true,
|
|
11
|
+
allowScrollSection:false,
|
|
12
|
+
allowLayout: { // {} | false
|
|
13
|
+
// type
|
|
14
|
+
allowGrid: true,
|
|
15
|
+
allowStack: true,
|
|
16
|
+
// distribute
|
|
17
|
+
allowedDistribution: ["start", "center", "end", "space-between", "space-around", "space-evenly"], // [] | false
|
|
18
|
+
// align
|
|
19
|
+
allowedAlignement: ["start", "center", "end"], // [] | false
|
|
20
|
+
// wrap
|
|
21
|
+
allowWrap: true,
|
|
22
|
+
// gap
|
|
23
|
+
allowGap: true,
|
|
24
|
+
// padding
|
|
25
|
+
allowPadding: true,
|
|
26
|
+
},
|
|
27
|
+
// typography
|
|
28
|
+
allowTypography: false,
|
|
29
|
+
// overlay
|
|
30
|
+
allowedOverlay: ["fixed"], // [] | false
|
|
31
|
+
// styles
|
|
32
|
+
allowStyle: { // {} | false
|
|
33
|
+
allowOpacity: false,
|
|
34
|
+
allowVisibility: false,
|
|
35
|
+
allowFill: true,
|
|
36
|
+
allowOverflow: true,
|
|
37
|
+
allowRadius: false,
|
|
38
|
+
allowBorder: false,
|
|
39
|
+
allowZIndex: false,
|
|
40
|
+
},
|
|
41
|
+
// link
|
|
42
|
+
allowLink: false,
|
|
43
|
+
// position
|
|
44
|
+
allowedPosition: false, // [] | false
|
|
45
|
+
// size
|
|
46
|
+
allowSize: { // {} | false
|
|
47
|
+
allowedWidth: ["fixed"],
|
|
48
|
+
allowedHeight: ["fixed"],
|
|
49
|
+
allowMinMaxWidth: false,
|
|
50
|
+
allowMinMaxHeight: false,
|
|
51
|
+
}
|
|
52
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import WebComponent from '$lib/registry/webComponentRegistry/components/WebComponent.svelte';
|
|
3
|
+
import { webPageRegistry } from '../registry.svelte';
|
|
4
|
+
|
|
5
|
+
let { path } = $props();
|
|
6
|
+
|
|
7
|
+
const webPage = $derived(webPageRegistry.select(path));
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
{#if $webPage}
|
|
11
|
+
<WebComponent id={$webPage.children.id} pagePath={$webPage.path}></WebComponent>
|
|
12
|
+
{/if}
|
|
13
|
+
|
|
14
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { sendRequest } from "hamzus-ui";
|
|
2
|
+
import { get } from "svelte/store";
|
|
3
|
+
import { createWebComponent } from "../webComponentRegistry/createWebComponent";
|
|
4
|
+
import { webComponentRegistry } from "../webComponentRegistry/registry.svelte";
|
|
5
|
+
import { webPageRegistry } from "./registry.svelte";
|
|
6
|
+
|
|
7
|
+
export function createWebPage(config = {}) {
|
|
8
|
+
const webPage = {
|
|
9
|
+
AI: 1,
|
|
10
|
+
path: "/",
|
|
11
|
+
children: {},
|
|
12
|
+
children_index: {}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
Object.assign(webPage, config);
|
|
16
|
+
|
|
17
|
+
webPage.update = ()=>{
|
|
18
|
+
webPageRegistry.update(webPage.path)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return webPage;
|
|
22
|
+
}
|