@functionalcms/svelte-components 0.0.1
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 +58 -0
- package/dist/assets/emblem-reverse.png +0 -0
- package/dist/assets/emblem.png +0 -0
- package/dist/assets/logo.png +0 -0
- package/dist/components/Box.svelte +45 -0
- package/dist/components/Box.svelte.d.ts +33 -0
- package/dist/components/Footer.svelte +26 -0
- package/dist/components/Footer.svelte.d.ts +23 -0
- package/dist/components/Header.svelte +58 -0
- package/dist/components/Header.svelte.d.ts +23 -0
- package/dist/components/Hero.svelte +31 -0
- package/dist/components/Hero.svelte.d.ts +31 -0
- package/dist/constants.d.ts +5 -0
- package/dist/constants.js +6 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +13 -0
- package/package.json +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# create-svelte
|
|
2
|
+
|
|
3
|
+
Everything you need to build a Svelte library, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte).
|
|
4
|
+
|
|
5
|
+
Read more about creating a library [in the docs](https://kit.svelte.dev/docs/packaging).
|
|
6
|
+
|
|
7
|
+
## Creating a project
|
|
8
|
+
|
|
9
|
+
If you're seeing this, you've probably already done this step. Congrats!
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# create a new project in the current directory
|
|
13
|
+
npm create svelte@latest
|
|
14
|
+
|
|
15
|
+
# create a new project in my-app
|
|
16
|
+
npm create svelte@latest my-app
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Developing
|
|
20
|
+
|
|
21
|
+
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm run dev
|
|
25
|
+
|
|
26
|
+
# or start the server and open the app in a new browser tab
|
|
27
|
+
npm run dev -- --open
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
|
|
31
|
+
|
|
32
|
+
## Building
|
|
33
|
+
|
|
34
|
+
To build your library:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm run package
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
To create a production version of your showcase app:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm run build
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
You can preview the production build with `npm run preview`.
|
|
47
|
+
|
|
48
|
+
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
|
|
49
|
+
|
|
50
|
+
## Publishing
|
|
51
|
+
|
|
52
|
+
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/)).
|
|
53
|
+
|
|
54
|
+
To publish your library to [npm](https://www.npmjs.com):
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm publish
|
|
58
|
+
```
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
/**
|
|
3
|
+
* @type {string}
|
|
4
|
+
*/
|
|
5
|
+
export let url;
|
|
6
|
+
/**
|
|
7
|
+
* @type {url}
|
|
8
|
+
*/
|
|
9
|
+
export let logoSrc;
|
|
10
|
+
/**
|
|
11
|
+
* @type {string}
|
|
12
|
+
*/
|
|
13
|
+
export let logoAlt;
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<article class="box">
|
|
17
|
+
<a href={url}>
|
|
18
|
+
<img class="img" src={logoSrc} alt={logoAlt} />
|
|
19
|
+
</a>
|
|
20
|
+
<h1 class="pbs32 pbe32 pis32 pie32">
|
|
21
|
+
<a href={url}>
|
|
22
|
+
<slot name="header" />
|
|
23
|
+
</a>
|
|
24
|
+
</h1>
|
|
25
|
+
<p class="card-demo-desc mbe24">
|
|
26
|
+
<slot />
|
|
27
|
+
</p>
|
|
28
|
+
</article>
|
|
29
|
+
|
|
30
|
+
<style>
|
|
31
|
+
.box {
|
|
32
|
+
width: 500px;
|
|
33
|
+
margin: var(--fluid-32);
|
|
34
|
+
padding: 0 var(--fluid-12);
|
|
35
|
+
border: 2px solid black;
|
|
36
|
+
box-shadow: 2px 2px 5px var(--accent-color);
|
|
37
|
+
-moz-border-radius: 10px;
|
|
38
|
+
-webkit-border-radius: 10px;
|
|
39
|
+
border-radius: 10px; /* future proofing */
|
|
40
|
+
-khtml-border-radius: 10px; /* for old Konqueror browsers */
|
|
41
|
+
}
|
|
42
|
+
.img {
|
|
43
|
+
width: 450px;
|
|
44
|
+
}
|
|
45
|
+
</style>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} BoxProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} BoxEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} BoxSlots */
|
|
4
|
+
export default class Box extends SvelteComponent<{
|
|
5
|
+
url: string;
|
|
6
|
+
logoSrc: string;
|
|
7
|
+
logoAlt: string;
|
|
8
|
+
}, {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
}, {
|
|
11
|
+
header: {};
|
|
12
|
+
default: {};
|
|
13
|
+
}> {
|
|
14
|
+
}
|
|
15
|
+
export type BoxProps = typeof __propDef.props;
|
|
16
|
+
export type BoxEvents = typeof __propDef.events;
|
|
17
|
+
export type BoxSlots = typeof __propDef.slots;
|
|
18
|
+
import { SvelteComponent } from "svelte";
|
|
19
|
+
declare const __propDef: {
|
|
20
|
+
props: {
|
|
21
|
+
url: string;
|
|
22
|
+
logoSrc: string;
|
|
23
|
+
logoAlt: string;
|
|
24
|
+
};
|
|
25
|
+
events: {
|
|
26
|
+
[evt: string]: CustomEvent<any>;
|
|
27
|
+
};
|
|
28
|
+
slots: {
|
|
29
|
+
header: {};
|
|
30
|
+
default: {};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import logo from '../assets/emblem-reverse.png';
|
|
3
|
+
import { constants } from '../constants';
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<footer class="flex-shrink-0">
|
|
7
|
+
<aside class="items-center grid-flow-col">
|
|
8
|
+
<img src={logo} alt="logo" />
|
|
9
|
+
<p>{constants.Motto}</p>
|
|
10
|
+
<p>Copyright © 2023 - All right reserved by {constants.Company}</p>
|
|
11
|
+
<p>Powerd by Functional CMS</p>
|
|
12
|
+
</aside>
|
|
13
|
+
</footer>
|
|
14
|
+
|
|
15
|
+
<style>
|
|
16
|
+
footer {
|
|
17
|
+
background-color: var(--footer-background-color);
|
|
18
|
+
color: var(--footer-color);
|
|
19
|
+
text-align: center;
|
|
20
|
+
padding: var(--fluid-12);
|
|
21
|
+
font-size: var(--fluid-14);
|
|
22
|
+
}
|
|
23
|
+
a {
|
|
24
|
+
color: var(--footer-color);
|
|
25
|
+
}
|
|
26
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} FooterProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} FooterEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} FooterSlots */
|
|
4
|
+
export default class Footer extends SvelteComponent<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type FooterProps = typeof __propDef.props;
|
|
11
|
+
export type FooterEvents = typeof __propDef.events;
|
|
12
|
+
export type FooterSlots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponent } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
[x: string]: never;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
|
|
4
|
+
import { Header, HeaderNav, HeaderNavItem } from "agnostic-svelte";
|
|
5
|
+
import logo from "../assets/logo.png";
|
|
6
|
+
import { constants } from "../constants";
|
|
7
|
+
|
|
8
|
+
const { url } = import.meta;
|
|
9
|
+
const modules = import.meta.glob("../../routes/*/*.svelte");
|
|
10
|
+
const navItems = constants.Navigation;
|
|
11
|
+
|
|
12
|
+
function getPages(url, modules) {
|
|
13
|
+
const directory = url
|
|
14
|
+
.replace(/(.*?)\/src\/lib\/components\//, "/")
|
|
15
|
+
.replace(/(.*?)\/src\/routes\//, "/")
|
|
16
|
+
.replace(/(.*?)\/immutable\/pages\//, "/")
|
|
17
|
+
.replace(/(.*?)\/var\/task\//, "/") // Vercel
|
|
18
|
+
.replace(/\/([^/])*.svelte.*/, "/");
|
|
19
|
+
const pageRegex = /\/\+page\.svelte$/;
|
|
20
|
+
const paths = Object.keys(modules)
|
|
21
|
+
.map((path) => path.replace(/^(.\/)/, directory))
|
|
22
|
+
.filter((path) => !/\[.*\]/.test(path))
|
|
23
|
+
.filter((path) => pageRegex.test(path))
|
|
24
|
+
.map((path) => path.replace(pageRegex, ""))
|
|
25
|
+
.map((path) => path || "/")
|
|
26
|
+
.map((path) => path.replace("../../routes/", ""))
|
|
27
|
+
.map((path) => path.replace("../../routes", ""))
|
|
28
|
+
.filter((page) => navItems.hasOwnProperty(page))
|
|
29
|
+
.sort();
|
|
30
|
+
return paths;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const pages = getPages(url, modules);
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<div class="container">
|
|
37
|
+
<Header>
|
|
38
|
+
<div slot="logoleft">
|
|
39
|
+
<a href="/">
|
|
40
|
+
<img src={logo} alt="Functional IT Solutions" />
|
|
41
|
+
</a>
|
|
42
|
+
</div>
|
|
43
|
+
<HeaderNav css="nav-overrides">
|
|
44
|
+
{#each pages as page}
|
|
45
|
+
<HeaderNavItem
|
|
46
|
+
><a href={page}>{navItems[page]}</a></HeaderNavItem
|
|
47
|
+
>
|
|
48
|
+
{/each}
|
|
49
|
+
</HeaderNav>
|
|
50
|
+
</Header>
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<style>
|
|
54
|
+
a {
|
|
55
|
+
font-size: var(--fluid-20) !important;
|
|
56
|
+
font-weight: bold;
|
|
57
|
+
}
|
|
58
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} HeaderProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} HeaderEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} HeaderSlots */
|
|
4
|
+
export default class Header extends SvelteComponent<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type HeaderProps = typeof __propDef.props;
|
|
11
|
+
export type HeaderEvents = typeof __propDef.events;
|
|
12
|
+
export type HeaderSlots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponent } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
[x: string]: never;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
/**
|
|
3
|
+
* @type {string}
|
|
4
|
+
*/
|
|
5
|
+
export let url;
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<header>
|
|
9
|
+
<h1>
|
|
10
|
+
<slot name="header" />
|
|
11
|
+
</h1>
|
|
12
|
+
<p>
|
|
13
|
+
<slot />
|
|
14
|
+
</p>
|
|
15
|
+
<div>
|
|
16
|
+
<a class="item keychainify-checked" href={url}>
|
|
17
|
+
<slot name="link" />
|
|
18
|
+
</a>
|
|
19
|
+
</div>
|
|
20
|
+
</header>
|
|
21
|
+
|
|
22
|
+
<style>
|
|
23
|
+
header {
|
|
24
|
+
margin-top: var(--fluid-24);
|
|
25
|
+
margin-bottom: var(--fluid-48);
|
|
26
|
+
text-align: center;
|
|
27
|
+
}
|
|
28
|
+
h1 {
|
|
29
|
+
font-size: var(--fluid-48);
|
|
30
|
+
}
|
|
31
|
+
</style>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} HeroProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} HeroEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} HeroSlots */
|
|
4
|
+
export default class Hero extends SvelteComponent<{
|
|
5
|
+
url: string;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {
|
|
9
|
+
header: {};
|
|
10
|
+
default: {};
|
|
11
|
+
link: {};
|
|
12
|
+
}> {
|
|
13
|
+
}
|
|
14
|
+
export type HeroProps = typeof __propDef.props;
|
|
15
|
+
export type HeroEvents = typeof __propDef.events;
|
|
16
|
+
export type HeroSlots = typeof __propDef.slots;
|
|
17
|
+
import { SvelteComponent } from "svelte";
|
|
18
|
+
declare const __propDef: {
|
|
19
|
+
props: {
|
|
20
|
+
url: string;
|
|
21
|
+
};
|
|
22
|
+
events: {
|
|
23
|
+
[evt: string]: CustomEvent<any>;
|
|
24
|
+
};
|
|
25
|
+
slots: {
|
|
26
|
+
header: {};
|
|
27
|
+
default: {};
|
|
28
|
+
link: {};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export {};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Reexport your entry components here
|
|
2
|
+
|
|
3
|
+
import Box from './components/Box.svelte';
|
|
4
|
+
import Hero from './components/Hero.svelte';
|
|
5
|
+
import Header from './components/Header.svelte';
|
|
6
|
+
import Footer from './components/Footer.svelte';
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
Box,
|
|
10
|
+
Hero,
|
|
11
|
+
Header,
|
|
12
|
+
Footer
|
|
13
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@functionalcms/svelte-components",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"author": "Functional IT Solutions",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"main": "dist/index.js",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"dev": "vite dev",
|
|
12
|
+
"build": "vite build && npm run package",
|
|
13
|
+
"preview": "vite preview",
|
|
14
|
+
"package": "svelte-kit sync && svelte-package && publint",
|
|
15
|
+
"prepublishOnly": "npm run package",
|
|
16
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
17
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
18
|
+
"lint": "prettier --plugin-search-dir . --check . && eslint .",
|
|
19
|
+
"format": "prettier --plugin-search-dir . --write ."
|
|
20
|
+
},
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"svelte": "./dist/index.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"!dist/**/*.test.*",
|
|
30
|
+
"!dist/**/*.spec.*"
|
|
31
|
+
],
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"svelte": "^4.0.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@sveltejs/adapter-auto": "^2.0.0",
|
|
37
|
+
"@sveltejs/kit": "^1.20.4",
|
|
38
|
+
"@sveltejs/package": "^2.0.0",
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "^5.45.0",
|
|
40
|
+
"@typescript-eslint/parser": "^5.45.0",
|
|
41
|
+
"eslint": "^8.28.0",
|
|
42
|
+
"eslint-config-prettier": "^8.5.0",
|
|
43
|
+
"eslint-plugin-svelte": "^2.30.0",
|
|
44
|
+
"prettier": "^2.8.0",
|
|
45
|
+
"prettier-plugin-svelte": "^2.10.1",
|
|
46
|
+
"publint": "^0.1.9",
|
|
47
|
+
"svelte": "^4.0.5",
|
|
48
|
+
"svelte-check": "^3.4.3",
|
|
49
|
+
"tslib": "^2.4.1",
|
|
50
|
+
"typescript": "^5.0.0",
|
|
51
|
+
"vite": "^4.4.2",
|
|
52
|
+
"agnostic-svelte": "^1.1.27"
|
|
53
|
+
},
|
|
54
|
+
"svelte": "./dist/index.js",
|
|
55
|
+
"types": "./dist/index.d.ts",
|
|
56
|
+
"type": "module"
|
|
57
|
+
}
|