refactor: Cleanup git state - commit all staged changes

Major refactoring cleanup:
- Add new controller architecture (class-controller-*.php)
- Add new settings-v2 UI (views/settings-v2/)
- Add new CSS architecture (agentic-sidebar.css, tokens)
- Add esbuild build pipeline (scripts/build.js, package.json)
- Add composer dependencies (vendor/)
- Add frontend src directory (assets/js/src/index.jsx)
- Add documentation files
- Remove old/obsolete files (class-settings.php, old CSS)

This commits all pending changes from previous refactoring efforts.
This commit is contained in:
Dwindi Ramadhana
2026-06-17 05:27:58 +07:00
parent d3f142222c
commit 690991c526
7963 changed files with 941566 additions and 67372 deletions

View File

@@ -0,0 +1,46 @@
<?php declare(strict_types=1);
/**
* This file is part of the Parsica library.
*
* Copyright (c) 2020 Mathias Verraes <mathias@verraes.net>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Tests\Parsica\Parsica\JSON;
use PHPUnit\Framework\TestCase;
use Parsica\Parsica\JSON\JSON;
use Parsica\Parsica\PHPUnit\ParserAssertions;
use function Parsica\Parsica\JSON\key_value;
final class ArrayTest extends TestCase
{
use ParserAssertions;
/**
* @test
* @dataProvider examples
*/
public function array(string $input, $expected)
{
$parser = JSON::array();
$this->assertParses($input, $parser, $expected);
}
public function examples()
{
return [
['[]', []],
['[ ] ', []],
['[ 1 ] ', [1.0]],
['[ true ] ', [true]],
['[ 1.23, "abc", null, false ] ', [ 1.23, "abc", null, false]],
];
}
}

View File

@@ -0,0 +1,64 @@
<?php declare(strict_types=1);
/**
* This file is part of the Parsica library.
*
* Copyright (c) 2020 Mathias Verraes <mathias@verraes.net>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Tests\Parsica\Parsica\JSON;
use PHPUnit\Framework\TestCase;
use Parsica\Parsica\JSON\JSON;
final class JSONTest extends TestCase
{
public static function examples(): array
{
return [
['true'],
['false'],
['null'],
['"abc"'],
['{"a b":"c d"}'],
[' { " a b " : " c d " } '],
[' [ { " a b " : " c d " } ] '],
[' [ { " a b " : " c d " } , { "ef" : "gh" } ] '],
['"some weird chars \\n in \\t strings \\u9999 should do it"'],
['"this \\\\ is just a backslash"'],
[<<<JSON
[
-1.23,
null,
true,
[
[
{
"a": true
},
{
"b": false,
"c": -1.23456789E+123
}
]
]
]
JSON,
],
[file_get_contents(__DIR__ . '/../../composer.json')],
];
}
/**
* @test
* @dataProvider examples
*/
public function compare_to_json_decode(string $input)
{
$native = json_decode($input);
$parsica = JSON::json()->tryString($input)->output();
$this->assertEquals($native, $parsica);
}
}

View File

@@ -0,0 +1,38 @@
<?php declare(strict_types=1);
/**
* This file is part of the Parsica library.
*
* Copyright (c) 2020 Mathias Verraes <mathias@verraes.net>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Tests\Parsica\Parsica\JSON;
use PHPUnit\Framework\TestCase;
use Parsica\Parsica\JSON\JSON;
use Parsica\Parsica\PHPUnit\ParserAssertions;
final class NumberTest extends TestCase
{
use ParserAssertions;
/** @test */
public function number()
{
$this->assertParses("0", JSON::number(), 0.0);
$this->assertParses("0.1", JSON::number(), 0.1);
$this->assertParses("0.15", JSON::number(), 0.15);
$this->assertParses("0.10", JSON::number(), 0.1);
$this->assertParses("-0.1", JSON::number(), -0.1);
$this->assertParses("1.2345678", JSON::number(), 1.2345678);
$this->assertParses("-1.2345678", JSON::number(), -1.2345678);
$this->assertParses("-1.23456789E+123", JSON::number(), -1.23456789E+123);
$this->assertParses("-1.23456789e-123", JSON::number(), -1.23456789E-123);
$this->assertParses("-1E-123", JSON::number(), -1E-123);
$this->assertParses("-1E-123 ", JSON::number(), -1E-123);
}
}

View File

@@ -0,0 +1,45 @@
<?php declare(strict_types=1);
/**
* This file is part of the Parsica library.
*
* Copyright (c) 2020 Mathias Verraes <mathias@verraes.net>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Tests\Parsica\Parsica\JSON;
use PHPUnit\Framework\TestCase;
use Parsica\Parsica\JSON\JSON;
use Parsica\Parsica\PHPUnit\ParserAssertions;
use Parsica\Parsica\StringStream;
final class ObjectTest extends TestCase
{
use ParserAssertions;
/** @test */
public function member()
{
$input = '"foo":"bar"';
$parser = JSON::member();
$this->assertParses($input, $parser, ["foo" => "bar"]);
}
/** @test */
public function object()
{
$input = '{"foo":"bar","bar":"foo"}';
$parser = JSON::object();
$result = $parser->run(new StringStream($input));
$this->assertParses($input, $parser, (object)["foo" => "bar", "bar" => "foo"]);
}
}

View File

@@ -0,0 +1,61 @@
<?php declare(strict_types=1);
/**
* This file is part of the Parsica library.
*
* Copyright (c) 2020 Mathias Verraes <mathias@verraes.net>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Tests\Parsica\Parsica\JSON;
use PHPUnit\Framework\TestCase;
use Parsica\Parsica\JSON\JSON;
use Parsica\Parsica\PHPUnit\ParserAssertions;
final class StringLiteralTest extends TestCase
{
use ParserAssertions;
public static function escapedChars(): array
{
return [
// label => [literal that will appear in json, expected character it results in]
"quotation mark" => ["\\\"", '"'],
"reverse solidus" => ['\\\\', '\\'],
"solidus" => ["\\/", '/'],
"backspace" => ["\\b", mb_chr(8)],
"formfeed" => ["\\f", mb_chr(12)],
"linefeed" => ["\\n", "\n"],
"carriage return" => ["\\r", "\r"],
"horizontal tab" => ["\\t", "\t"],
];
}
/** @test */
public function empty()
{
$this->assertParses('""', JSON::stringLiteral(), "");
}
/**
* @test
* @dataProvider escapedChars
*/
public function escapes(string $input, string $expected)
{
$this->assertParses('"' . $input . '"', JSON::stringLiteral(), $expected);
$this->assertParses('"a' . $input . '"', JSON::stringLiteral(), "a" . $expected);
$this->assertParses('"' . $input . 'a"', JSON::stringLiteral(), $expected . "a");
}
/** @test */
public function escape_hex()
{
$input = '"\\u0BB9\\u0BB2\\u0BCB\\u0020\\u0B89\\u0BB2\\u0B95\\u0BAE\\u0BCD"';
$this->assertParses($input, JSON::stringLiteral(), "ஹலோ உலகம்");
}
}

View File

@@ -0,0 +1,32 @@
<?php declare(strict_types=1);
/**
* This file is part of the Parsica library.
*
* Copyright (c) 2020 Mathias Verraes <mathias@verraes.net>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Tests\Parsica\Parsica\JSON;
use PHPUnit\Framework\TestCase;
use Parsica\Parsica\JSON\JSON;
use Parsica\Parsica\PHPUnit\ParserAssertions;
use function Parsica\Parsica\char;
use function Parsica\Parsica\JSON\token;
final class TokenTest extends TestCase
{
use ParserAssertions;
/** @test */
public function token()
{
$parser = JSON::token(char('a'));
$input = "a \n \tb";
$this->assertRemainder($input, $parser, "b");
}
}

View File

@@ -0,0 +1,79 @@
<?php declare(strict_types=1);
/**
* This file is part of the Parsica library.
*
* Copyright (c) 2020 Mathias Verraes <mathias@verraes.net>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Tests\Parsica\Parsica\JSON;
use PHPUnit\Framework\TestCase;
use Parsica\Parsica\JSON\JSON;
use Parsica\Parsica\PHPUnit\ParserAssertions;
use function Parsica\Parsica\JSON\ws;
final class WhitespaceTest extends TestCase
{
use ParserAssertions;
/** @test */
public function ws_empty()
{
$expected = null;
$input = "";
$parser = JSON::ws();
$this->assertParses($input, $parser, $expected);
}
/** @test */
public function ws_space()
{
$expected = null;
$input = " ";
$parser = JSON::ws();
$this->assertParses($input, $parser, $expected);
}
/** @test */
public function ws_tab()
{
$expected = null;
$input = "\t";
$parser = JSON::ws();
$this->assertParses($input, $parser, $expected);
}
/** @test */
public function ws_newline()
{
$expected = null;
$input = "\n";
$parser = JSON::ws();
$this->assertParses($input, $parser, $expected);
}
/** @test */
public function ws_carriage_return()
{
$expected = null;
$input = "\r";
$parser = JSON::ws();
$this->assertParses($input, $parser, $expected);
}
/** @test */
public function a_bunch_of_whitespace()
{
$expected = null;
$input = " \n \r \t a";
$parser = JSON::ws();
$this->assertParses($input, $parser, $expected);
$this->assertRemainder($input, $parser, "a");
}
}