first pass at meta data

This commit is contained in:
Geoff Doty 2025-03-29 10:58:57 -04:00
parent 5b7341ce65
commit 8f30754bcc
7 changed files with 245 additions and 0 deletions

32
.gitignore vendored Normal file
View File

@ -0,0 +1,32 @@
# temp scrach pads
examples/*
scratch.js
# manged dependencies
node_modules
# output
dist
*.tgz
# code coverage
coverage
*.lcov
# logs
logs
# dotenv environment variable files
.env
# caches
.eslintcache
.cache
*.tsbuildinfo
# IDEs
.idea
.vscode
# Finder (MacOS) folder config
.DS_Store

70
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,70 @@
# Contributing
So you want to contribute, nice. **Thank you**.
Bug reports and code and documentation patches are all welcome. You can help this project also by using the development version and by reporting any bugs you might encounter.
You may contribute in several ways like:
* Creating new features
* Fixing bugs
* Improving documentation and examples
* Translating any document here to your language
## Table of contents
* [Contributing](#contributing)
* [Developing](#developing)
* [Running tests](#running-tests)
* [Reporting a bug](#reporting-a-bug)
* [Request a feature](#request-a-feature)
* [Commit message](#commit-message)
* [Code style](#code-style)
## Developing
There is only one main source file in the project. It is the [/src/index.js](/src/Mite.js).
The [test/mite.spec.js](test/mite.test.js) is for now the only unit test file in the project.
The `dist` includes the minified version of the source code.
## Running tests
Run unit tests using this command:
```bash
bun test
```
## Reporting a bug
Use the [GitHub issue tracker](https://github.com/n2geoff/mite/issues) to report any bug you find.
Bugs description should include:
* How to reproduce the bug;
* Easy to understand title;
Would be nice to have some code showing how to reproduce the code, you may use [gist](https://gist.github.com) or [Codepen](https://codepen.io) for uploading your example code.
## Request a feature
Use the [GitHub issue tracker](https://github.com/n2geoff/mite/issues) to request a new feature.
Keep in mind, this is a pure javascript library
## Commit message
Commit messages should includes GitHub number reference and a imperative easy to understand sentence.
## Coding style
If it is supported in all major browers without transpiling, then please use those JavaScript language features in your code, with one caveat -- readablity is king.
Currently the JavaScript Target is ES2017.
This project is linted agaist [ESLint](https://eslint.org/) and the [`.eslintrc.js`](.eslintrc.js) is dead-simple, and all you need to followed.
Thank you for reading this.
Hey, **star** this *repo* and/or share it with your friends.

19
LICENSE Normal file
View File

@ -0,0 +1,19 @@
Copyright (c) 2025 Geoff Doty
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

78
README.md Normal file
View File

@ -0,0 +1,78 @@
# Mite
> The tiniest framework that *mite* work
```
/___\ ___ _
)O.o( |\/| o | |_ BE small
\_^_/ | | | | |_ be STRONG
" "
```
Brainspace is limited, time is limited, ideas are abundant, so enter stage left: **Mite**
**Mite** is a tiny `import` ui library that was born out of a necessity to rift out prototypes fast, and complement existing HTML/CSS/JS knowledge. The boiler-plate of most conventional frameworks takes longer than actually getting the core MVP of the idea out there.
**Mite** provides an extendable one-and-done solutions from decorating components to building out single-page-applications -- pure-frontend, and core-web for the win!
With **Mite** it is just one file and go...
## Getting Started
### Key Features
- **Reactive Data Binding**: Bind data to the DOM using `{{ }}` syntax, and Mite will automatically update the DOM when the data changes.
- **Directives**:
- `m-if`: Conditionally show or hide elements based on a truthy/falsy expression.
- `m-each`: Iterate over arrays to render lists dynamically.
- `:`-prefixed attributes (e.g., `:value`): Bind data to element attributes.
- **Event Handling**: Bind events to methods using `@event` syntax (e.g., `@click`).
- **Lightweight**: Mite is a single class with no external dependencies, making it easy to integrate into any project.
## Usage
```html
<div id="counter">
<button @click="{increment}">{count}</button>
</div>
<script type="module">
import Mite from './src/Mite.js';
new Mite('#counter', {
data: {count: 0},
increment(e) {
e.preventDefault();
this.data.count++;
}
});
</script>
```
Any tag property that starts with a `@` is an event, so you can do `@click=""`;
## Test
**WIP**
`bun test`
> Currently [Bun]() is used as the development runtime
## Support
Please open [an issue](https://github.com/n2geoff/mite/issues/new) for support.
## Contributing
Anyone is welcome to contribute, however, if you decide to get involved, please take a moment to review the [guidelines](CONTRIBUTING.md), they're minimalistic;)
## License
[MIT](LICENSE)
---
*Last updated: March 29, 2025*

28
jsconfig.json Normal file
View File

@ -0,0 +1,28 @@
{
"compilerOptions": {
// Environment setup & latest features
"lib": ["ESNext"],
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
// Bundler mode
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false
}
}

12
package.json Normal file
View File

@ -0,0 +1,12 @@
{
"name": "mite",
"description": "",
"version": "1.0.0",
"module": "src/Mite.js",
"type": "module",
"scripts": {
"build": "bun build ./src/Mite.js --outdir ./dist --target browser"
},
"devDependencies": {},
"peerDependencies": {}
}

6
test/mite.test.js Normal file
View File

@ -0,0 +1,6 @@
import { expect, test } from "bun:test";
import { Mite } from "../src/Mite.js";
test("Mite Exists", () => {
expect(typeof Mite).toBe("function");
});