meta: initial commit (archival)
This commit is contained in:
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/build
|
||||
/.svelte-kit
|
||||
/package
|
38
README.md
Normal file
38
README.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# create-svelte
|
||||
|
||||
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte);
|
||||
|
||||
## Creating a project
|
||||
|
||||
If you're seeing this, you've probably already done this step. Congrats!
|
||||
|
||||
```bash
|
||||
# create a new project in the current directory
|
||||
npm init svelte@next
|
||||
|
||||
# create a new project in my-app
|
||||
npm init svelte@next my-app
|
||||
```
|
||||
|
||||
> Note: the `@next` is temporary
|
||||
|
||||
## Developing
|
||||
|
||||
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
|
||||
# or start the server and open the app in a new browser tab
|
||||
npm run dev -- --open
|
||||
```
|
||||
|
||||
## Building
|
||||
|
||||
Before creating a production version of your app, install an [adapter](https://kit.svelte.dev/docs#adapters) for your target environment. Then:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
> You can preview the built app with `npm run preview`, regardless of whether you installed an adapter. This should _not_ be used to serve your app in production.
|
10
jsconfig.json
Normal file
10
jsconfig.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"$lib": ["src/lib"],
|
||||
"$lib/*": ["src/lib/*"]
|
||||
}
|
||||
},
|
||||
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"]
|
||||
}
|
20
package.json
Normal file
20
package.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "~TODO~",
|
||||
"version": "0.0.1",
|
||||
"scripts": {
|
||||
"dev": "svelte-kit dev",
|
||||
"build": "svelte-kit build",
|
||||
"preview": "svelte-kit preview"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/kit": "next",
|
||||
"svelte": "^3.34.0",
|
||||
"postcss": "^8.3.5",
|
||||
"postcss-load-config": "^3.1.0",
|
||||
"svelte-preprocess": "^4.7.4",
|
||||
"autoprefixer": "^10.3.1",
|
||||
"cssnano": "^5.0.6",
|
||||
"tailwindcss": "^2.2.4"
|
||||
},
|
||||
"type": "module"
|
||||
}
|
1635
pnpm-lock.yaml
generated
Normal file
1635
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
20
postcss.config.cjs
Normal file
20
postcss.config.cjs
Normal file
@@ -0,0 +1,20 @@
|
||||
const tailwindcss = require("tailwindcss");
|
||||
const autoprefixer = require("autoprefixer");
|
||||
const cssnano = require("cssnano");
|
||||
|
||||
const mode = process.env.NODE_ENV;
|
||||
const dev = mode === "development";
|
||||
|
||||
const config = {
|
||||
plugins: [
|
||||
//Some plugins, like tailwindcss/nesting, need to run before Tailwind,
|
||||
tailwindcss(),
|
||||
//But others, like autoprefixer, need to run after,
|
||||
autoprefixer(),
|
||||
!dev && cssnano({
|
||||
preset: "default",
|
||||
})
|
||||
],
|
||||
};
|
||||
|
||||
module.exports = config;
|
12
src/app.html
Normal file
12
src/app.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="/favicon.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
%svelte.head%
|
||||
</head>
|
||||
<body>
|
||||
<div id="svelte">%svelte.body%</div>
|
||||
</body>
|
||||
</html>
|
4
src/app.postcss
Normal file
4
src/app.postcss
Normal file
@@ -0,0 +1,4 @@
|
||||
@tailwind base;
|
||||
/* Write your global styles here, in PostCSS syntax */
|
||||
@tailwind components;
|
||||
@tailwind utilities
|
1
src/global.d.ts
vendored
Normal file
1
src/global.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/// <reference types="@sveltejs/kit" />
|
2
src/routes/__layout.svelte
Normal file
2
src/routes/__layout.svelte
Normal file
@@ -0,0 +1,2 @@
|
||||
<script>import "../app.postcss";</script>
|
||||
<slot></slot>
|
76
src/routes/index.svelte
Normal file
76
src/routes/index.svelte
Normal file
@@ -0,0 +1,76 @@
|
||||
<script>
|
||||
import {flip} from "svelte/animate";
|
||||
|
||||
let value = "Write input here";
|
||||
$: frequencyInfo = analyzeWords(value);
|
||||
|
||||
/** @param {string} text */
|
||||
const analyzeWords = (text) => {
|
||||
const frequencies = new Map();
|
||||
|
||||
const lines = text.trim().split(/\r?\n/);
|
||||
|
||||
for (const line of lines) {
|
||||
const words = line.trim().split(" ");
|
||||
|
||||
for (const word of words) {
|
||||
if (word === "") continue;
|
||||
const wordClean = word.toLowerCase();
|
||||
frequencies.set(wordClean, (frequencies.get(wordClean) ?? 0) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
const entries = Array.from(frequencies.entries());
|
||||
// Sort alphabetically
|
||||
entries.sort(([aKey, a], [bKey, b]) => aKey.localeCompare(bKey));
|
||||
// Sort by frequency
|
||||
entries.sort(([aKey, a], [bKey, b]) => b - a);
|
||||
|
||||
return entries;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="flex min-h-screen items-stretch justify-stretch">
|
||||
<textarea class="resize-none flex-1 p-4" bind:value></textarea>
|
||||
<div class="flex-1 bg-gray-100">
|
||||
<table class="w-full p-4">
|
||||
<thead>
|
||||
<tr class="bg-gray-200">
|
||||
<th class="text-right">#</th>
|
||||
<th>Word</th>
|
||||
<th>Frequency</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each Array.from(frequencyInfo.entries()) as [index, [word, frequency]] (word)}
|
||||
<tr>
|
||||
<td class="text-right tabular-nums">{index+1}</td>
|
||||
<td class="px-4">{word}</td>
|
||||
<td class="text-right tabular-nums">{frequency}</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="flex-1 bg-gray-100">
|
||||
<table class="w-full p-4">
|
||||
<thead>
|
||||
<tr class="bg-gray-200">
|
||||
<th class="text-right">#</th>
|
||||
<th>Word</th>
|
||||
<th>Frequency</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each Array.from(frequencyInfo.entries()) as [index, [word, frequency]] (word)}
|
||||
<tr>
|
||||
<td class="text-right tabular-nums">{index+1}</td>
|
||||
<td class="px-4">{word}</td>
|
||||
<td class="text-right tabular-nums">{frequency}</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
BIN
static/favicon.png
Normal file
BIN
static/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
14
svelte.config.js
Normal file
14
svelte.config.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import preprocess from "svelte-preprocess";
|
||||
/** @type {import('@sveltejs/kit').Config} */
|
||||
const config = {
|
||||
kit: {
|
||||
// hydrate the <div id="svelte"> element in src/app.html
|
||||
target: '#svelte'
|
||||
},
|
||||
|
||||
preprocess: [preprocess({
|
||||
"postcss": true
|
||||
})]
|
||||
};
|
||||
|
||||
export default config;
|
12
tailwind.config.cjs
Normal file
12
tailwind.config.cjs
Normal file
@@ -0,0 +1,12 @@
|
||||
const config = {
|
||||
mode: "jit",
|
||||
purge: [
|
||||
"./src/**/*.{html,js,svelte,ts}",
|
||||
],
|
||||
theme: {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [],
|
||||
};
|
||||
|
||||
module.exports = config;
|
Reference in New Issue
Block a user