Run pnpm format
This commit is contained in:
parent
0f6263d82e
commit
d37fd6bea0
@ -6,15 +6,15 @@ module.exports = {
|
||||
ignorePatterns: ['*.cjs'],
|
||||
overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
|
||||
settings: {
|
||||
'svelte3/typescript': () => require('typescript')
|
||||
'svelte3/typescript': () => require('typescript'),
|
||||
},
|
||||
parserOptions: {
|
||||
sourceType: 'module',
|
||||
ecmaVersion: 2020
|
||||
ecmaVersion: 2020,
|
||||
},
|
||||
env: {
|
||||
browser: true,
|
||||
es2017: true,
|
||||
node: true
|
||||
}
|
||||
node: true,
|
||||
},
|
||||
};
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { defineMDSveXConfig as defineConfig } from 'mdsvex';
|
||||
import examples from 'mdsvexamples'
|
||||
import examples from 'mdsvexamples';
|
||||
|
||||
const config = defineConfig({
|
||||
extensions: ['.svelte.md', '.md', '.svx'],
|
||||
@ -13,16 +13,16 @@ const config = defineConfig({
|
||||
examples,
|
||||
{
|
||||
defaults: {
|
||||
Wrapper: '$routes/_internal/components/Example.svelte'
|
||||
}
|
||||
}
|
||||
]
|
||||
Wrapper: '$routes/_internal/components/Example.svelte',
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
rehypePlugins: [],
|
||||
|
||||
layout: {
|
||||
_: "./src/routes/_internal/layout/page.svelte",
|
||||
}
|
||||
_: './src/routes/_internal/layout/page.svelte',
|
||||
},
|
||||
});
|
||||
|
||||
export default config;
|
||||
|
||||
@ -1,55 +1,58 @@
|
||||
import {ComponentParser} from 'sveld'
|
||||
import * as svelte from 'svelte/compiler'
|
||||
import fs from 'fs/promises'
|
||||
import path from 'path'
|
||||
import {preprocess} from "../src/package/config/svelte.config.js";
|
||||
import { ComponentParser } from 'sveld';
|
||||
import * as svelte from 'svelte/compiler';
|
||||
import fs from 'fs/promises';
|
||||
import path from 'path';
|
||||
import { preprocess } from '../src/package/config/svelte.config.js';
|
||||
|
||||
export default function sveld() {
|
||||
return {
|
||||
name: 'vite-plugin-sveld',
|
||||
async transform(src, id) {
|
||||
if (id.endsWith('?raw&sveld')) {
|
||||
const raw = JSON.parse(src.split('export default ')[1])
|
||||
const raw = JSON.parse(src.split('export default ')[1]);
|
||||
|
||||
const data = await parseRaw(raw, id)
|
||||
const data = await parseRaw(raw, id);
|
||||
|
||||
return {
|
||||
code: `export default ${JSON.stringify(data)}`,
|
||||
map: null
|
||||
}
|
||||
map: null,
|
||||
};
|
||||
}
|
||||
},
|
||||
// This generates a `COMPONENT_API.json` with sveld in the `/_app` folder on build, which is used by the docs about components (only when built statically)
|
||||
async buildStart() {
|
||||
const output = {};
|
||||
|
||||
const componentFiles = await fs.readdir(path.resolve('./src/package/components'))
|
||||
const componentFiles = await fs.readdir(path.resolve('./src/package/components'));
|
||||
|
||||
for (const fileName of componentFiles) {
|
||||
const filePath = path.resolve('./src/package/components', fileName)
|
||||
const raw = (await fs.readFile(filePath)).toString()
|
||||
output[fileName] = await parseRaw(raw, filePath)
|
||||
const filePath = path.resolve('./src/package/components', fileName);
|
||||
const raw = (await fs.readFile(filePath)).toString();
|
||||
output[fileName] = await parseRaw(raw, filePath);
|
||||
}
|
||||
|
||||
try {
|
||||
await fs.mkdir(path.resolve('./src/generated'))
|
||||
await fs.mkdir(path.resolve('./src/generated'));
|
||||
} catch {
|
||||
// Do nothing, directory already exists
|
||||
}
|
||||
|
||||
await fs.writeFile(path.resolve('./src/generated/COMPONENT_API.json'), JSON.stringify(output))
|
||||
await fs.writeFile(
|
||||
path.resolve('./src/generated/COMPONENT_API.json'),
|
||||
JSON.stringify(output)
|
||||
);
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
async function parseRaw(raw, filePath) {
|
||||
let { code } = await svelte.preprocess(raw, preprocess, {
|
||||
filename: filePath
|
||||
})
|
||||
filename: filePath,
|
||||
});
|
||||
return new ComponentParser({
|
||||
verbose: false
|
||||
verbose: false,
|
||||
}).parseSvelteComponent(code, {
|
||||
filePath,
|
||||
moduleName: filePath
|
||||
})
|
||||
moduleName: filePath,
|
||||
});
|
||||
}
|
||||
@ -1 +1 @@
|
||||
module.exports = require('./src/package/config/postcss.config.cjs')
|
||||
module.exports = require('./src/package/config/postcss.config.cjs');
|
||||
|
||||
@ -6,9 +6,9 @@
|
||||
<link rel="icon" href="%svelte.assets%/assets/omorphia.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
|
||||
<meta name="theme-color" content="#CF1971">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:image" content="https://omorphia.modrinth.com/assets/omorphia.png">
|
||||
<meta name="theme-color" content="#CF1971" />
|
||||
<meta name="twitter:card" content="summary" />
|
||||
<meta name="twitter:image" content="https://omorphia.modrinth.com/assets/omorphia.png" />
|
||||
<meta property="og:site_name" content="Modrinth" />
|
||||
|
||||
%svelte.head%
|
||||
|
||||
@ -17,15 +17,16 @@ const config = {
|
||||
'--xl': '(min-width: 1280px)',
|
||||
},
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
},
|
||||
},
|
||||
}),
|
||||
require('postcss-pxtorem'),
|
||||
require('autoprefixer'),
|
||||
process.env.NODE_ENV === 'development' && require('cssnano')({
|
||||
process.env.NODE_ENV === 'development' &&
|
||||
require('cssnano')({
|
||||
preset: 'default',
|
||||
})
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
import { fetch } from 'undici';
|
||||
import { promises as fs } from 'fs';
|
||||
import sharp from 'sharp';
|
||||
import FastAverageColor from 'fast-average-color';
|
||||
import cliProgress from 'cli-progress';
|
||||
|
||||
export async function landingPage(API_URL: string) {
|
||||
|
||||
@ -11,6 +11,6 @@
|
||||
|
||||
&__description {
|
||||
font-size: 1.2rem;
|
||||
color: var(--color-text-light)
|
||||
color: var(--color-text-light);
|
||||
}
|
||||
}
|
||||
@ -20,7 +20,6 @@
|
||||
|
||||
&:hover {
|
||||
color: var(--color-link);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,4 @@
|
||||
:root {
|
||||
|
||||
/* these are values for the display CSS property */
|
||||
/*
|
||||
--display-values: (
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
--font-weight-bold: 600;
|
||||
|
||||
/* Font stacks */
|
||||
--body-font: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
|
||||
--body-font: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif,
|
||||
'Apple Color Emoji', 'Segoe UI Emoji';
|
||||
--mono-font: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
|
||||
}
|
||||
@ -35,7 +35,9 @@ export function ago(
|
||||
if (diffAbs >= interval.ge) {
|
||||
const x = Math.round(Math.abs(diff) / interval.divisor);
|
||||
const isFuture = diff < 0;
|
||||
return interval.unit ? rft.format(isFuture ? x : -x, interval.unit as Unit) : interval.text;
|
||||
return interval.unit
|
||||
? rft.format(isFuture ? x : -x, interval.unit as Unit)
|
||||
: interval.text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
export function classCombine(names) {
|
||||
return names.filter(name => name && !name.includes('undefined')).join(' ')
|
||||
return names.filter((name) => name && !name.includes('undefined')).join(' ');
|
||||
}
|
||||
@ -1,40 +0,0 @@
|
||||
/**
|
||||
* Convert large numbers to human readable strings
|
||||
* @source https://github.com/rohmanhm/simplify-number
|
||||
*/
|
||||
export function simplify(num = 0): string {
|
||||
let numberVar = num;
|
||||
|
||||
// 2 decimal places => 100, 3 => 1000, etc
|
||||
const decPlaces = Math.pow(10, 1);
|
||||
|
||||
// Enumerate number abbreviations
|
||||
const abbrev = ['K', 'M', 'B', 'T'];
|
||||
|
||||
// Go through the array backwards, so we do the largest first
|
||||
for (let i = abbrev.length - 1; i >= 0; i--) {
|
||||
// Convert array index to "1000", "1000000", etc
|
||||
const size = Math.pow(10, (i + 1) * 3);
|
||||
|
||||
// If the number is bigger or equal do the abbreviation
|
||||
if (size <= numberVar) {
|
||||
// Here, we multiply by decPlaces, round, and then divide by decPlaces.
|
||||
// This gives us nice rounding to a particular decimal place.
|
||||
numberVar = Math.round((numberVar * decPlaces) / size) / decPlaces;
|
||||
|
||||
// Handle special case where we round up to the next abbreviation
|
||||
if (numberVar === 1000 && i < abbrev.length - 1) {
|
||||
numberVar = 1;
|
||||
i++;
|
||||
}
|
||||
|
||||
// Add the letter for the abbreviation
|
||||
(numberVar as any) += abbrev[i];
|
||||
|
||||
// We are done... stop
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return String(numberVar);
|
||||
}
|
||||
@ -48,7 +48,10 @@ export function formatVersions(versionArray: string[]): string {
|
||||
]);
|
||||
|
||||
if (lastSnapshot !== null && lastSnapshot !== j + 1) {
|
||||
newIntervals.push([[allVersions[lastSnapshot].version, lastSnapshot, -1], interval[1]]);
|
||||
newIntervals.push([
|
||||
[allVersions[lastSnapshot].version, lastSnapshot, -1],
|
||||
interval[1],
|
||||
]);
|
||||
} else {
|
||||
newIntervals.push([interval[1]]);
|
||||
}
|
||||
|
||||
@ -28,6 +28,7 @@ import { page } from '$app/stores';
|
||||
<a href="/getting-started/css" class="section__link">Writing CSS</a>
|
||||
<a href="/getting-started/illustrations" class="section__link">Illustrations</a>
|
||||
<a href="/getting-started/utils" class="section__link">Built-in utilities</a>
|
||||
<a href="/getting-started/generator" class="section__link">Generator plugin</a>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
|
||||
@ -27,12 +27,14 @@
|
||||
position: relative;
|
||||
}
|
||||
|
||||
&:where(h2:first-child, h1:first-child, h1:first-child + h2, h3:first-child, h4:first-child, h5:first-child, h6:first-child) {
|
||||
&:where(h2:first-child, h1:first-child, h1:first-child
|
||||
+ h2, h3:first-child, h4:first-child, h5:first-child, h6:first-child) {
|
||||
margin-top: 0;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
&:where(h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor, h5:hover a.anchor, h6:hover a.anchor) {
|
||||
&:where(h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor, h5:hover
|
||||
a.anchor, h6:hover a.anchor) {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
@ -119,12 +121,14 @@
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
&:where(body > h3:first-child, body > h4:first-child, body > h5:first-child, body > h6:first-child) {
|
||||
&:where(body > h3:first-child, body > h4:first-child, body > h5:first-child, body
|
||||
> h6:first-child) {
|
||||
margin-top: 0;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
&:where(a:first-child h1, a:first-child h2, a:first-child h3, a:first-child h4, a:first-child h5, a:first-child h6) {
|
||||
&:where(a:first-child h1, a:first-child h2, a:first-child h3, a:first-child h4, a:first-child
|
||||
h5, a:first-child h6) {
|
||||
margin-top: 0;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
@ -28,12 +28,12 @@
|
||||
* --syntax-cursor-line: hsla(220, 100%, 80%, 0.04);
|
||||
*/
|
||||
|
||||
code[class*="language-"],
|
||||
pre[class*="language-"] {
|
||||
code[class*='language-'],
|
||||
pre[class*='language-'] {
|
||||
background: hsl(220, 13%, 18%);
|
||||
color: hsl(220, 14%, 71%);
|
||||
text-shadow: 0 1px rgba(0, 0, 0, 0.3);
|
||||
font-family: "Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
|
||||
font-family: 'Fira Code', 'Fira Mono', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
|
||||
direction: ltr;
|
||||
text-align: left;
|
||||
white-space: pre;
|
||||
@ -50,24 +50,24 @@ pre[class*="language-"] {
|
||||
}
|
||||
|
||||
/* Selection */
|
||||
code[class*="language-"]::-moz-selection,
|
||||
code[class*="language-"] *::-moz-selection,
|
||||
pre[class*="language-"] *::-moz-selection {
|
||||
code[class*='language-']::-moz-selection,
|
||||
code[class*='language-'] *::-moz-selection,
|
||||
pre[class*='language-'] *::-moz-selection {
|
||||
background: hsl(220, 13%, 28%);
|
||||
color: inherit;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
code[class*="language-"]::selection,
|
||||
code[class*="language-"] *::selection,
|
||||
pre[class*="language-"] *::selection {
|
||||
code[class*='language-']::selection,
|
||||
code[class*='language-'] *::selection,
|
||||
pre[class*='language-'] *::selection {
|
||||
background: hsl(220, 13%, 28%);
|
||||
color: inherit;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
/* Code blocks */
|
||||
pre[class*="language-"] {
|
||||
pre[class*='language-'] {
|
||||
padding: 16px;
|
||||
margin: 0.5em 0;
|
||||
overflow: auto;
|
||||
@ -75,7 +75,7 @@ pre[class*="language-"] {
|
||||
}
|
||||
|
||||
/* Inline code */
|
||||
:not(pre) > code[class*="language-"] {
|
||||
:not(pre) > code[class*='language-'] {
|
||||
padding: 0.2em 0.3em;
|
||||
border-radius: 0.3em;
|
||||
white-space: normal;
|
||||
@ -83,8 +83,8 @@ pre[class*="language-"] {
|
||||
|
||||
/* Print */
|
||||
@media print {
|
||||
code[class*="language-"],
|
||||
pre[class*="language-"] {
|
||||
code[class*='language-'],
|
||||
pre[class*='language-'] {
|
||||
text-shadow: none;
|
||||
}
|
||||
}
|
||||
@ -178,7 +178,10 @@ pre[class*="language-"] {
|
||||
color: hsl(286, 60%, 67%);
|
||||
}
|
||||
|
||||
.language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation {
|
||||
.language-javascript
|
||||
.token.template-string
|
||||
> .token.interpolation
|
||||
> .token.interpolation-punctuation.punctuation {
|
||||
color: hsl(5, 48%, 51%);
|
||||
}
|
||||
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
/>
|
||||
```
|
||||
|
||||
|
||||
### Force an option to be selected with `neverEmpty`
|
||||
|
||||
```svelte example raised
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
```svelte example
|
||||
```svelte example raised
|
||||
<script lang="ts">
|
||||
import { Slider } from "omorphia";
|
||||
</script>
|
||||
|
||||
@ -9,19 +9,15 @@ To make use of the built-in icons, styles, and plugins in omorphia, you will nee
|
||||
Add the following parts to your `svelte.config.js` file:
|
||||
|
||||
```js
|
||||
import { preprocess, plugins } from 'omorphia/config/svelte.config'
|
||||
import { preprocess, plugins } from 'omorphia/config/svelte.config';
|
||||
|
||||
/** @type {import('@sveltejs/kit').Config} */
|
||||
const config = {
|
||||
preprocess: [
|
||||
preprocess,
|
||||
],
|
||||
preprocess: [preprocess],
|
||||
|
||||
kit: {
|
||||
vite: {
|
||||
plugins: [
|
||||
...plugins,
|
||||
],
|
||||
plugins: [...plugins],
|
||||
},
|
||||
},
|
||||
};
|
||||
@ -36,5 +32,5 @@ Create a `postcss.config.cjs` file in the root of your project.
|
||||
Add the following line to that file:
|
||||
|
||||
```js
|
||||
module.exports = require('omorphia/config/postcss.config.cjs')
|
||||
module.exports = require('omorphia/config/postcss.config.cjs');
|
||||
```
|
||||
@ -1,19 +1,16 @@
|
||||
import { mdsvex } from 'mdsvex';
|
||||
import mdsvexConfig from './mdsvex.config.js';
|
||||
import adapter from '@sveltejs/adapter-static';
|
||||
import examples from 'mdsvexamples/vite'
|
||||
import sveld from './plugins/sveld.js'
|
||||
import path from "path";
|
||||
import { preprocess, plugins } from './src/package/config/svelte.config.js'
|
||||
import examples from 'mdsvexamples/vite';
|
||||
import sveld from './plugins/sveld.js';
|
||||
import path from 'path';
|
||||
import { preprocess, plugins } from './src/package/config/svelte.config.js';
|
||||
|
||||
/** @type {import('@sveltejs/kit').Config} */
|
||||
const config = {
|
||||
extensions: ['.svelte', ...mdsvexConfig.extensions],
|
||||
|
||||
preprocess: [
|
||||
preprocess,
|
||||
mdsvex(mdsvexConfig),
|
||||
],
|
||||
preprocess: [preprocess, mdsvex(mdsvexConfig)],
|
||||
|
||||
kit: {
|
||||
adapter: adapter(),
|
||||
@ -38,13 +35,13 @@ const config = {
|
||||
|
||||
build: {
|
||||
rollupOptions: {
|
||||
external: '/_app/COMPONENT_API.json'
|
||||
}
|
||||
}
|
||||
external: '/_app/COMPONENT_API.json',
|
||||
},
|
||||
},
|
||||
},
|
||||
files: {
|
||||
lib: 'src/package',
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user