Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 23 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,68 +53,55 @@ KompKit provides essential utility functions that work seamlessly across Web (Ty

### Installation

> **Note**: Alpha packages are not yet published to registries. Clone the repository for local development.

#### Web Development
#### Web (npm)

```bash
# Clone the repository
git clone https://github.com/Kompkit/KompKit.git
cd KompKit
npm i kompkit-core
```

> Published on [npmjs.com/package/kompkit-core](https://www.npmjs.com/package/kompkit-core)

# Install dependencies
npm install
#### Flutter / Dart (pub.dev)

# Build the web package
npm run build
Add to your `pubspec.yaml`:

# Run tests
npm run test:web
```yaml
dependencies:
kompkit_core: ^0.2.0-alpha.0
```

#### Android Development
Then run:

```bash
# Clone the repository
git clone https://github.com/Kompkit/KompKit.git
flutter pub get
```

> Published on [pub.dev/packages/kompkit_core](https://pub.dev/packages/kompkit_core)

#### Android (Kotlin) — Local only

# Include in your Android project's settings.gradle.kts
> **Note**: The Android/Kotlin package is not yet published to Maven. Use a local project reference for now.

```kotlin
// settings.gradle.kts
include(":kompkit-core")
project(":kompkit-core").projectDir = file("path/to/KompKit/packages/core/android")

# Add to your app's build.gradle.kts
// app/build.gradle.kts
dependencies {
implementation(project(":kompkit-core"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2")
}
```

#### Flutter Development

```bash
# Clone the repository
git clone https://github.com/Kompkit/KompKit.git

# Add to your Flutter project's pubspec.yaml
dependencies:
kompkit_core:
path: path/to/KompKit/packages/core/flutter

# Get dependencies
flutter pub get

# Run tests
flutter test
```

### Quick Start

Once installed, you can import and use KompKit utilities:

**TypeScript/JavaScript:**

```typescript
import { debounce, isEmail, formatCurrency } from "@kompkit/core";
import { debounce, isEmail, formatCurrency } from "kompkit-core";

const search = debounce((query: string) => {
console.log("Searching:", query);
Expand Down
13 changes: 11 additions & 2 deletions docs/android.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,20 @@ Status: `V0.2.0-alpha`.

## Installation

Add the dependency to your module `build.gradle.kts`:
> **Note**: The Android/Kotlin package is not yet published to Maven. Use a local project reference for now.

Add the project reference to your `settings.gradle.kts`:

```kotlin
include(":kompkit-core")
project(":kompkit-core").projectDir = file("path/to/KompKit/packages/core/android")
```

Then add the dependency to your module `build.gradle.kts`:

```kotlin
dependencies {
implementation("com.kompkit:core:<version>")
implementation(project(":kompkit-core"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2")
}
```
Expand Down
8 changes: 4 additions & 4 deletions docs/flutter.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ Add KompKit Core to your `pubspec.yaml`:

```yaml
dependencies:
kompkit_core:
path: path/to/KompKit/packages/core/flutter
kompkit_core: ^0.2.0-alpha.0
```

Then run:
Expand All @@ -22,14 +21,15 @@ Then run:
flutter pub get
```

> Published on [pub.dev/packages/kompkit_core](https://pub.dev/packages/kompkit_core)

### Dart Projects

For server-side Dart projects, add to your `pubspec.yaml`:

```yaml
dependencies:
kompkit_core:
path: path/to/KompKit/packages/core/flutter
kompkit_core: ^0.2.0-alpha.0
```

Then run:
Expand Down
39 changes: 24 additions & 15 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,40 @@ Status: `V0.2.0-alpha`.

## Install

### Web (React/Vue)
### Web (npm)

```bash
npm i @kompkit/core
npm i kompkit-core
```

### Android (Gradle)
> [npmjs.com/package/kompkit-core](https://www.npmjs.com/package/kompkit-core)

Add the dependency to your module build file:
### Flutter / Dart (pub.dev)

```kotlin
dependencies {
implementation("com.kompkit:core:<version>")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2")
}
Add to your `pubspec.yaml`:

```yaml
dependencies:
kompkit_core: ^0.2.0-alpha.0
```

Then run:

```bash
flutter pub get
```

### Flutter (pubspec.yaml)
> [pub.dev/packages/kompkit_core](https://pub.dev/packages/kompkit_core)

Add the dependency to your pubspec.yaml:
### Android (Gradle) — Local only

```yaml
dependencies:
kompkit_core:
path: path/to/KompKit/packages/core/flutter
> Not yet published to Maven. Use a local project reference for now.

```kotlin
dependencies {
implementation(project(":kompkit-core"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2")
}
```

## Build and test locally
Expand Down
22 changes: 11 additions & 11 deletions docs/recipes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Real-world examples using KompKit Core utilities.

```tsx
import { useState, useEffect } from "react";
import { debounce } from "@kompkit/core";
import { debounce } from "kompkit-core";

function SearchComponent() {
const [query, setQuery] = useState("");
Expand Down Expand Up @@ -160,7 +160,7 @@ class _SearchScreenState extends State<SearchScreen> {

```tsx
import { useState } from "react";
import { formatCurrency } from "@kompkit/core";
import { formatCurrency } from "kompkit-core";

function PriceDisplay({ amount }: { amount: number }) {
const [locale, setLocale] = useState<"en-US" | "es-ES" | "ja-JP">("en-US");
Expand Down Expand Up @@ -191,7 +191,7 @@ function PriceDisplay({ amount }: { amount: number }) {

```tsx
import { useState } from "react";
import { isEmail } from "@kompkit/core";
import { isEmail } from "kompkit-core";

function ContactForm() {
const [email, setEmail] = useState("");
Expand Down Expand Up @@ -231,22 +231,22 @@ import 'package:kompkit_core/kompkit_core.dart';

class PriceDisplay extends StatefulWidget {
final double amount;

const PriceDisplay({Key? key, required this.amount}) : super(key: key);

@override
_PriceDisplayState createState() => _PriceDisplayState();
}

class _PriceDisplayState extends State<PriceDisplay> {
String _selectedLocale = 'en_US';

final Map<String, Map<String, String>> _localeConfig = {
'en_US': {'currency': 'USD', 'locale': 'en_US'},
'es_ES': {'currency': 'EUR', 'locale': 'es_ES'},
'ja_JP': {'currency': 'JPY', 'locale': 'ja_JP'},
};

@override
Widget build(BuildContext context) {
final config = _localeConfig[_selectedLocale]!;
Expand All @@ -255,7 +255,7 @@ class _PriceDisplayState extends State<PriceDisplay> {
currency: config['currency']!,
locale: config['locale']!,
);

return Column(
children: [
Text(
Expand Down Expand Up @@ -297,7 +297,7 @@ class ContactForm extends StatefulWidget {
class _ContactFormState extends State<ContactForm> {
final TextEditingController _emailController = TextEditingController();
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();

void _handleSubmit() {
if (_formKey.currentState!.validate()) {
// Submit form
Expand All @@ -307,7 +307,7 @@ class _ContactFormState extends State<ContactForm> {
);
}
}

String? _validateEmail(String? value) {
if (value == null || value.isEmpty) {
return 'Email is required';
Expand All @@ -317,7 +317,7 @@ class _ContactFormState extends State<ContactForm> {
}
return null;
}

@override
Widget build(BuildContext context) {
return Scaffold(
Expand Down
16 changes: 8 additions & 8 deletions docs/web.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,29 @@ Status: `V0.2.0-alpha`.
## Installation

```bash
npm i @kompkit/core
npm i kompkit-core
```

## Imports

ESM:

```ts
import { debounce, isEmail, formatCurrency } from "@kompkit/core";
import { debounce, isEmail, formatCurrency } from "kompkit-core";
```

CommonJS:

```js
const { debounce, isEmail, formatCurrency } = require("@kompkit/core");
const { debounce, isEmail, formatCurrency } = require("kompkit-core");
```

## Usage examples

### debounce

```ts
import { debounce } from "@kompkit/core";
import { debounce } from "kompkit-core";

const onType = debounce((value: string) => {
console.log("Search:", value);
Expand All @@ -43,7 +43,7 @@ onType("kompkit"); // only this call will execute after ~300ms
### isEmail

```ts
import { isEmail } from "@kompkit/core";
import { isEmail } from "kompkit-core";

isEmail("test@example.com"); // true
isEmail("invalid@"); // false
Expand All @@ -52,7 +52,7 @@ isEmail("invalid@"); // false
### formatCurrency

```ts
import { formatCurrency } from "@kompkit/core";
import { formatCurrency } from "kompkit-core";

formatCurrency(1234.56); // "1.234,56 €" (es-ES by default)
formatCurrency(1234.56, "USD", "en-US"); // "$1,234.56"
Expand All @@ -62,7 +62,7 @@ formatCurrency(1234.56, "USD", "en-US"); // "$1,234.56"

```tsx
import { useState } from "react";
import { debounce } from "@kompkit/core";
import { debounce } from "kompkit-core";

export function SearchBox() {
const [value, setValue] = useState("");
Expand All @@ -85,7 +85,7 @@ export function SearchBox() {
```vue
<script setup lang="ts">
import { ref } from "vue";
import { debounce } from "@kompkit/core";
import { debounce } from "kompkit-core";

const value = ref("");
const run = debounce((v: string) => console.log("search", v), 250);
Expand Down
4 changes: 2 additions & 2 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.1.0",
"version": "0.2.0-alpha.0",
"npmClient": "npm",
"packages": ["packages/core/web"],
"command": {
Expand All @@ -8,4 +8,4 @@
"message": "chore(release): publish %s"
}
}
}
}
Loading
Loading