Initialize new repo

This commit is contained in:
Chad Freeman 2024-11-09 00:34:32 -05:00
commit 6a4b4bdaeb
45 changed files with 1007 additions and 0 deletions

175
.gitignore vendored Normal file
View file

@ -0,0 +1,175 @@
# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
# Logs
logs
_.log
npm-debug.log_
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Caches
.cache
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
# Runtime data
pids
_.pid
_.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
# IntelliJ based IDEs
.idea
# Finder (MacOS) folder config
.DS_Store

17
README.md Normal file
View file

@ -0,0 +1,17 @@
# Sprigsy editor
# planned for v1
- [ ] ability to play project
- [ ] monaco code editor
- [ ] export project for sprig
- [ ] docs site
- [ ] typescript support (esbuild prob)
# planned for v2
- [ ] sprite manager
- [ ] level manager
- [ ] build project as a standalone `.html` file
- [ ] run on device
- [ ] downloadable version

21
apps/site/.gitignore vendored Normal file
View file

@ -0,0 +1,21 @@
node_modules
# Output
.output
.vercel
/.svelte-kit
/build
# OS
.DS_Store
Thumbs.db
# Env
.env
.env.*
!.env.example
!.env.test
# Vite
vite.config.js.timestamp-*
vite.config.ts.timestamp-*

1
apps/site/.npmrc Normal file
View file

@ -0,0 +1 @@
engine-strict=true

38
apps/site/README.md Normal file
View file

@ -0,0 +1,38 @@
# sv
Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).
## 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
npx sv create
# create a new project in my-app
npx sv create my-app
```
## 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
To create a production version of your app:
```bash
npm run build
```
You can preview the production build with `npm run preview`.
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.

24
apps/site/package.json Normal file
View file

@ -0,0 +1,24 @@
{
"name": "site",
"version": "0.0.1",
"type": "module",
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^4.0.0",
"autoprefixer": "^10.4.20",
"babel-walk": "^3.0.1",
"svelte": "^5.0.0",
"svelte-check": "^4.0.0",
"tailwindcss": "^3.4.9",
"typescript": "^5.0.0",
"vite": "^5.0.3"
}
}

View file

@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {}
}
};

3
apps/site/src/app.css Normal file
View file

@ -0,0 +1,3 @@
@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities'

13
apps/site/src/app.d.ts vendored Normal file
View file

@ -0,0 +1,13 @@
// See https://svelte.dev/docs/kit/types#app.d.ts
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface PageState {}
// interface Platform {}
}
}
export {};

12
apps/site/src/app.html Normal file
View file

@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>

View file

@ -0,0 +1 @@
// place files you want to import through the `$lib` alias in this folder.

View file

@ -0,0 +1,6 @@
<script lang="ts">
import '../app.css';
let { children } = $props();
</script>
{@render children()}

View file

@ -0,0 +1,2 @@
<h1>Welcome to SvelteKit</h1>
<p>Visit <a href="https://svelte.dev/docs/kit">svelte.dev/docs/kit</a> to read the documentation</p>

View file

@ -0,0 +1,2 @@
export const prerender = true;
export const ssr = false;

View file

@ -0,0 +1,5 @@
<script>
import Core from "@sprigsy/core"
</script>
<Core />

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -0,0 +1,18 @@
import adapter from '@sveltejs/adapter-auto';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://svelte.dev/docs/kit/integrations
// for more information about preprocessors
preprocess: vitePreprocess(),
kit: {
// adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
adapter: adapter()
}
};
export default config;

View file

@ -0,0 +1,13 @@
import { join } from 'path';
import type { Config } from 'tailwindcss';
import daisyui from "daisyui"
export default {
content: ['./src/**/*.{html,js,svelte,ts}', join(require.resolve('@sprigsy/core'), '../**/*.{html,js,svelte,ts}')],
theme: {
extend: {}
},
plugins: [daisyui]
} satisfies Config;

19
apps/site/tsconfig.json Normal file
View file

@ -0,0 +1,19 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"moduleResolution": "bundler"
}
// Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias
// except $lib which is handled by https://svelte.dev/docs/kit/configuration#files
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
// from the referenced tsconfig.json - TypeScript does not merge them in
}

6
apps/site/vite.config.ts Normal file
View file

@ -0,0 +1,6 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [sveltekit()]
});

BIN
bun.lockb Executable file

Binary file not shown.

22
core/.gitignore vendored Normal file
View file

@ -0,0 +1,22 @@
node_modules
# Output
.output
.vercel
/.svelte-kit
/build
/dist
# OS
.DS_Store
Thumbs.db
# Env
.env
.env.*
!.env.example
!.env.test
# Vite
vite.config.js.timestamp-*
vite.config.ts.timestamp-*

1
core/.npmrc Normal file
View file

@ -0,0 +1 @@
engine-strict=true

58
core/README.md Normal file
View file

@ -0,0 +1,58 @@
# create-svelte
Everything you need to build a Svelte library, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte).
Read more about creating a library [in the docs](https://svelte.dev/docs/kit/packaging).
## 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
npx sv create
# create a new project in my-app
npx sv create my-app
```
## 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
```
Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
## Building
To build your library:
```bash
npm run package
```
To create a production version of your showcase app:
```bash
npm run build
```
You can preview the production build with `npm run preview`.
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
## Publishing
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/)).
To publish your library to [npm](https://www.npmjs.com):
```bash
npm publish
```

62
core/package.json Normal file
View file

@ -0,0 +1,62 @@
{
"name": "@sprigsy/core",
"version": "0.0.1",
"scripts": {
"dev": "vite dev",
"build": "vite build && npm run package",
"preview": "vite preview",
"package": "svelte-kit sync && svelte-package && publint",
"prepublishOnly": "npm run package",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
},
"files": [
"dist",
"!dist/**/*.test.*",
"!dist/**/*.spec.*"
],
"sideEffects": [
"**/*.css"
],
"svelte": "./dist/index.svelte",
"types": "./dist/index.svelte.d.ts",
"type": "module",
"exports": {
".": {
"types": "./dist/index.svelte.d.ts",
"svelte": "./dist/index.svelte",
"import": "./dist/index.svelte",
"default": "./dist/index.svelte"
},
"./package.json": "./package.json",
"./engine": {
"types": "./dist/engine.d.ts",
"import": "./dist/engine.js",
"default": "./dist/engine.js"
}
},
"peerDependencies": {
"svelte": "^5.0.0"
},
"devDependencies": {
"@babel/parser": "^7.26.2",
"@sprigsy/core": "workspace:*",
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/kit": "^2.5.27",
"@sveltejs/package": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^4.0.0",
"autoprefixer": "^10.4.20",
"babel-walk": "^3.0.1",
"constrained-editor-plugin": "^1.3.0",
"daisyui": "^4.12.14",
"esbuild-wasm": "^0.24.0",
"monaco-editor": "^0.52.0",
"publint": "^0.2.0",
"sprig": "^1.1.3",
"svelte": "^5.0.0",
"svelte-check": "^4.0.0",
"tailwindcss": "^3.4.9",
"typescript": "^5.5.0",
"vite": "^5.4.4"
}
}

6
core/postcss.config.js Normal file
View file

@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {}
}
};

12
core/src/app.css Normal file
View file

@ -0,0 +1,12 @@
@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';
#app {
@apply contents !h-full overflow-hidden;
}
body,
html {
@apply !h-full overflow-hidden;
}

13
core/src/app.d.ts vendored Normal file
View file

@ -0,0 +1,13 @@
// See https://svelte.dev/docs/kit/types#app.d.ts
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface PageState {}
// interface Platform {}
}
}
export {};

12
core/src/app.html Normal file
View file

@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div id="app">%sveltekit.body%</div>
</body>
</html>

View file

@ -0,0 +1,156 @@
<script lang="ts">
import { onMount } from 'svelte';
import * as monaco from 'monaco-editor';
import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker';
import { } from 'sprig/web';
import { constrainedEditor } from 'constrained-editor-plugin';
import { parse } from '@babel/parser';
import { buildProject } from './build/index.js';
let editorContainer: HTMLDivElement;
let editor: import('monaco-editor').editor.IStandaloneCodeEditor;
// const monaco = await import ('monaco-editor')
// Initial code inside the function
function debounce<A, T = void>(func: (this: T, ...args: A[]) => any, timeout = 300) {
let timer: number;
return function (this: T, ...args: A[]) {
clearTimeout(timer);
timer = setTimeout(() => {
func.apply(this, args);
}, timeout);
};
}
let { code = $bindable() }: { code: string } = $props();
onMount(async () => {
window.build = () => buildProject(code, true);
globalThis.process = {};
globalThis.process.env = {};
const { recursive } = await import('babel-walk');
await addGlobalTypes();
setupEditor();
self.MonacoEnvironment = {
getWorker: function (_: any, label: string) {
return new tsWorker();
}
};
async function addGlobalTypes() {
const sprigTypeDef = (await import('./editorcontext/sprig.d.ts?raw')).default;
monaco.languages.typescript.typescriptDefaults.addExtraLib(
sprigTypeDef,
'context/sprig.d.ts'
);
const globalTypeDef = (await import('./editorcontext/global.d.ts?raw')).default;
monaco.languages.typescript.typescriptDefaults.addExtraLib(globalTypeDef, 'global.d.ts');
// IMPLEMENT ONCE v2 IS DONE!
// const sprigsyTypeDef = (await import('./editorcontext/sprigsy.d.ts?raw')).default;
// monaco.languages.typescript.typescriptDefaults.addExtraLib(
// sprigsyTypeDef,
// 'context/sprigsy.d.ts'
// );
}
const disallowedIdentifiers = ['window', 'globalThis'];
type ASTState = {
disallowedWarnings: { identifier: string; loc: [number, number, number, number] }[];
errors: { reason: string; loc: [number, number, number, number] }[];
};
const ASTWalker = recursive<ASTState>({
Identifier(node, state, c) {
if (disallowedIdentifiers.includes(node.name)) {
state.disallowedWarnings.push({
identifier: node.name,
loc: [
node.loc?.start?.line!,
node.loc?.start?.column!,
node.loc?.end?.line!,
node.loc?.end?.column!
]
});
}
},
MemberExpression(node, state, c) {
if (node.optional) {
state.errors.push({
reason: 'optional chaining (?.) is not allowed (not supported on the sprig!!!)',
loc: [
node.loc?.start.line!,
node.loc?.start.column!,
node.loc?.end.line!,
node.loc?.end.column!
]
});
}
}
});
const checkBabel = debounce(() => {
let ast;
try {
ast = parse(editor.getValue(), {
plugins: ['typescript']
});
} catch {
return;
}
const state: ASTState = { disallowedWarnings: [], errors: [] };
ASTWalker(ast, state);
state.disallowedWarnings.forEach((v) => {
monaco.editor.setModelMarkers(editor.getModel()!, editor.getId(), [
{
message: `'${v.identifier}' is not allowed.`,
severity: monaco.MarkerSeverity.Error,
startLineNumber: v.loc[0],
startColumn: v.loc[1] + 1,
endLineNumber: v.loc[2],
endColumn: v.loc[3] + 1
}
]);
});
});
function setupEditor() {
editor = monaco.editor.create(editorContainer, {
value: `function game(api: sprig.FullSprigAPI): void {
// Code here
}`,
language: 'typescript',
automaticLayout: true,
scrollBeyondLastLine: false,
theme: 'vs-dark'
});
const model = editor.getModel()!;
const constrainedInstance = constrainedEditor(monaco);
constrainedInstance.initializeIn(editor);
constrainedInstance.addRestrictionsTo(model, [
{
range: [2, 1, 2, 14], // Range of Function definition
allowMultiline: true,
label: 'funcDefinition'
}
]);
model.updateValueInEditableRanges({
funcDefinition: code
});
editor.onDidChangeModelContent((event) => {
code = model.getValueInEditableRanges().funcDefinition;
checkBabel();
});
}
return () => {
if (editor) {
editor.dispose();
}
};
});
</script>
<div bind:this={editorContainer} class="editor-container"></div>
<style>
.editor-container {
height: 100vh;
width: 100%;
}
</style>

View file

@ -0,0 +1,23 @@
import { transform, initialize } from 'esbuild-wasm';
await initialize({
wasmURL: (await import('../../../node_modules/esbuild-wasm/esbuild.wasm?url')).default
});
export async function buildProject(code: string, vanilla: boolean) {
let template = '';
if (vanilla) {
template += `function game(api) {
${code}
}
console.log("Made with Sprigsy")
game({ addSprite, addText, afterInput, bitmap, clearInterval, clearText, clearTile, clearTimeout, color, getAll, getFirst, getGrid, getTile, height, map, onInput, playTune, setBackground, setInterval, setLegend, setMap, setPushables, setSolids, setTimeout, tilesWith, tune, width })
`;
} else {
throw new Error('not implemented');
}
return await transform(template, {
loader: 'ts'
});
}

View file

@ -0,0 +1,38 @@
<script lang="ts">
import type { Snippet } from 'svelte';
let {
tab = $bindable(),
disabled = $bindable(false),
map,
...props
}: {
tab: string | undefined;
disabled?: boolean;
map?: Record<string, string>;
class?: string;
[x: `_${string}`]: Snippet<[]>;
} = $props();
const tabs = Object.fromEntries(
Object.entries(props)
.filter((v) => v[0].startsWith('_'))
.map(([name, snippet]): [string, Snippet<[]>] => [name.replace('_', ''), snippet])
);
</script>
<div role="tablist" class="tabs tabs-boxed {props.class}">
{#each Object.entries(tabs) as [tabID]}
<!-- svelte-ignore a11y_interactive_supports_focus -->
<!-- svelte-ignore a11y_click_events_have_key_events -->
<!-- svelte-ignore a11y_missing_attribute -->
<a
class:cursor-not-allowed={disabled}
class:pointer-events-none={disabled}
class:tab-disabled={disabled}
role="tab"
class="tab uppercase"
onclick={() => (tab = tabID)}
class:tab-active={tabID == tab}>{@render tabs[tabID]()}</a
>
{/each}
</div>

View file

@ -0,0 +1,5 @@
// for some reason this doesn't work, I can't figure out why
declare global {
export declare function tune(template: TemplateStringsArray, ...params: string[]): string;
}

79
core/src/lib/editorcontext/sprig.d.ts vendored Normal file
View file

@ -0,0 +1,79 @@
/**
* normal sprig api
* this is provided because your project type is
*/
declare namespace sprig {
export declare const VALID_INPUTS: readonly ['w', 's', 'a', 'd', 'i', 'j', 'k', 'l'];
export type InputKey = (typeof VALID_INPUTS)[number];
export interface AddTextOptions {
x?: number;
y?: number;
color?: string;
}
export declare class SpriteType {
type: string;
x: number;
y: number;
readonly dx: number;
readonly dy: number;
remove(): void;
}
export type Rgba = [number, number, number, number];
export interface TextElement {
x: number;
y: number;
color: Rgba;
content: string;
}
export interface GameState {
legend: [string, string][];
texts: TextElement[];
dimensions: {
width: number;
height: number;
};
sprites: SpriteType[];
solids: string[];
pushable: Record<string, string[]>;
background: string | null;
}
export interface PlayTuneRes {
end(): void;
isPlaying(): boolean;
}
// export declare const tones: Record<string, number>;
// export declare const instruments: readonly ["sine", "triangle", "square", "sawtooth"];
export type InstrumentType = (typeof instruments)[number];
// export declare const instrumentKey: Record<string, InstrumentType>;
// export declare const reverseInstrumentKey: Record<"sine" | "triangle" | "square" | "sawtooth", string>;
export type Tune = [number, ...(InstrumentType | number | string)[]][];
export interface FullSprigAPI {
map(template: TemplateStringsArray, ...params: string[]): string;
bitmap(template: TemplateStringsArray, ...params: string[]): string;
color(template: TemplateStringsArray, ...params: string[]): string;
tune(template: TemplateStringsArray, ...params: string[]): string;
setMap(string: string): void;
addText(str: string, opts?: AddTextOptions): void;
clearText(): void;
addSprite(x: number, y: number, type: string): void;
getGrid(): SpriteType[][];
getTile(x: number, y: number): SpriteType[];
tilesWith(...matchingTypes: string[]): SpriteType[][];
clearTile(x: number, y: number): void;
setSolids(types: string[]): void;
setPushables(map: Record<string, string[]>): void;
setBackground(type: string): void;
getFirst(type: string): SpriteType | undefined;
getAll(type?: string): SpriteType[];
width(): number;
height(): number;
setLegend(...bitmaps: [string, string][]): void;
onInput(key: InputKey, fn: () => void): void;
afterInput(fn: () => void): void;
playTune(text: string, n?: number): PlayTuneRes;
setTimeout(fn: TimerHandler, ms: number): number;
setInterval(fn: TimerHandler, ms: number): number;
clearTimeout(id: number): void;
clearInterval(id: number): void;
}
}

13
core/src/lib/editorcontext/sprigsy.d.ts vendored Normal file
View file

@ -0,0 +1,13 @@
/**
* API for sprigsy
* this is provided because your project has sprigsy v2 enabeled
*/
declare namespace sprigsy {
export interface FullSprigsyAPI {
/**
* Retrieve a sprite key for the sprite name
* @param name Sprite name
*/
spriteKeyFor(name: string): string;
}
}

0
core/src/lib/engine.ts Normal file
View file

58
core/src/lib/index.svelte Normal file
View file

@ -0,0 +1,58 @@
<script>
import CodeEditor from '$lib/CodeEditor.svelte';
import Tab from '$lib/components/Tab.svelte';
let tab = $state('code');
let code = $state('');
</script>
<div class="flex !h-full w-full select-none flex-col bg-base-100">
<nav class="flex flex-row">
<Tab bind:tab>
{#snippet _settings()}<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="size-6"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M6 13.5V3.75m0 9.75a1.5 1.5 0 0 1 0 3m0-3a1.5 1.5 0 0 0 0 3m0 3.75V16.5m12-3V3.75m0 9.75a1.5 1.5 0 0 1 0 3m0-3a1.5 1.5 0 0 0 0 3m0 3.75V16.5m-6-9V3.75m0 3.75a1.5 1.5 0 0 1 0 3m0-3a1.5 1.5 0 0 0 0 3m0 9.75V10.5"
/>
</svg>
{/snippet}
{#snippet _code()}Code{/snippet}
{#snippet _test()}Test{/snippet}
{#snippet _tunes()}Tunes{/snippet}
{#snippet _sprites()}Sprites{/snippet}
{#snippet _maps()}Maps{/snippet}
</Tab>
<div class="flex flex-grow items-center justify-end">
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="size-6"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.347a1.125 1.125 0 0 1 0 1.972l-11.54 6.347a1.125 1.125 0 0 1-1.667-.986V5.653Z"
/>
</svg>
</div>
</nav>
{#if tab === 'code'}
<CodeEditor bind:code />
{:else if ['tunes', 'sprites', 'maps'].includes(tab)}
Not implemented
{:else if tab === 'settings'}
(Settings tab)
{:else if tab === 'test'}
This will have the game screen
{/if}
</div>

View file

@ -0,0 +1,6 @@
<script lang="ts">
import '../app.css';
let { children } = $props();
</script>
{@render children()}

View file

@ -0,0 +1,3 @@
<h1>Welcome to your library project</h1>
<p>Create your package using @sveltejs/package and preview/showcase your work with SvelteKit</p>
<p>Visit <a href="https://svelte.dev/docs/kit">svelte.dev/docs/kit</a> to read the documentation</p>

BIN
core/static/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

21
core/svelte.config.js Normal file
View file

@ -0,0 +1,21 @@
import adapter from '@sveltejs/adapter-auto';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://svelte.dev/docs/kit/integrations
// for more information about preprocessors
preprocess: vitePreprocess(),
kit: {
// adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
adapter: adapter()
},
compilerOptions: {
runes: true
}
};
export default config;

12
core/tailwind.config.ts Normal file
View file

@ -0,0 +1,12 @@
import type { Config } from 'tailwindcss';
import daisyui from "daisyui"
export default {
content: ['./src/**/*.{html,js,svelte,ts}'],
theme: {
extend: {}
},
plugins: [daisyui]
} satisfies Config;

15
core/tsconfig.json Normal file
View file

@ -0,0 +1,15 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"module": "NodeNext",
"moduleResolution": "NodeNext"
}
}

6
core/vite.config.ts Normal file
View file

@ -0,0 +1,6 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [sveltekit()]
});

4
package.json Normal file
View file

@ -0,0 +1,4 @@
{
"name": "sprigsy",
"workspaces": ["core", "apps/*"]
}