@ritishdas/garden
v1.0.0
Published
This is a json to dom and vice versa convertor
Readme
Gardener DOM Toolkit
A lightweight development toolkit for declarative DOM manipulation, HTML-to-JSON parsing, and integrated hot-reloading.
Features
- Gardener: Create complex DOM structures using JSON objects.
- Parser: Convert existing HTML/DOM elements into JSON format.
- Hot Reload: Built-in dev-mode hot reloading with persistent state.
- SVG Support: Seamlessly handles SVG elements and attributes.
Installation
npm install gardUsage
Declarative DOM
import { gardener, appendElement, fetchElement } from 'gardener-dom';
const myElement = gardener({
t: 'div',
cn: ['container'],
children: [
{ t: 'h1', txt: 'Hello Gardener!' },
{ t: 'button', txt: 'Click Me', events: { click: () => alert('Clicked!') } }
]
});
appendElement(fetchElement('body'), myElement);HTML to JSON Parser
import { parser } from 'gardener-dom';
const json = parser(document.querySelector('#my-element'));
console.log(json);3. LICENSE
Using the MIT license is the standard for open-source utilities.
MIT License
Copyright (c) 2026
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.