๐Ÿš€ Juris JSDoc TypeScript Definitions - jurisjs/juris GitHub Wiki

Complete TypeScript definitions for the Juris Framework - the revolutionary JavaScript Unified Reactive Interface Solution that's changing how we build web apps! โšก

๐Ÿ“š TypeScript Definitions Location (The Source!)

๐Ÿ“ฅ Download & Add to Your Project (Recommended!)

# Create types folder in your project
mkdir types

# Download the TypeScript definitions
curl -o types/index.d.ts https://raw.githubusercontent.com/jurisjs/juris/main/types/index.d.ts

# Download the type imports helper
curl -o index.juris.js https://raw.githubusercontent.com/jurisjs/juris/main/index.juris.js

# Download the jsconfig.json (optional - if you don't have one)
curl -o jsconfig.json https://raw.githubusercontent.com/jurisjs/juris/main/jsconfig.json

Or manually download:

  1. ๐Ÿ“ Create a types/ folder in your project root
  2. ๐Ÿ“„ Download [index.d.ts](https://raw.githubusercontent.com/jurisjs/juris/main/types/index.d.ts) โ†’ save as types/index.d.ts
  3. ๐Ÿ“„ Download [index.juris.js](https://raw.githubusercontent.com/jurisjs/juris/main/index.juris.js) โ†’ save as index.juris.js
  4. ๐Ÿ“„ Download [jsconfig.json](https://raw.githubusercontent.com/jurisjs/juris/main/jsconfig.json) โ†’ save as jsconfig.json (if needed)

๐ŸŽฏ Quick Setup (Get Started in 30 seconds!)

๐Ÿ“ฆ Installation

npm install juris

๐ŸŒ CDN (Zero Config!)

<script src="https://unpkg.com/[email protected]/juris.js"></script>

๐Ÿ”ง TypeScript Setup (Instant IntelliSense!)

Add jsconfig.json in your project root:

{
  "compilerOptions": {
    "checkJs": true,
    "allowJs": true
  },
  "include": ["**/*"]
}

Create index.juris.js for blazing-fast type imports:

/**
 * @typedef {import('./types').JurisElementOptions} JurisElementOptions
 * @typedef {import('./types').JurisVDOMElement} JurisVDOMElement
 * @typedef {import('./types').JurisContext} JurisContext
 */

Or reference the types directly in your JavaScript files:

// At the top of your JS files
/// <reference path="./types/index.d.ts" />

// Or use JSDoc imports for AMAZING autocomplete!
/** @typedef {import('./types/index.d.ts').JurisInstance} JurisInstance */
/** @typedef {import('./types/index.d.ts').JurisComponentFunction} JurisComponentFunction */

โšก Component Quick Start (Copy, Paste, Build!)

Use this JSDoc pattern for rapid component development:

/**
 * @param {Object} props
 * @param {JurisContext} context
 * @returns {JurisVDOMElement} 
 */
const MyComponent = (props, context) => {
  const { getState, setState } = context;
  
  return {
    div: {
      text: () => `Hello ${getState('user.name', 'World')}!`,
      onClick: () => setState('clicked', true)
    }
  };
};

/**
 * @param {Object} props
 * @param {JurisContext} context
 * @returns {JurisVDOMElement} 
 */
const TodoList = (props, context) => ({
  ul: {
    children: () => context.getState('todos', []).map(todo => ({
      li: { 
        text: todo.title,
        className: () => todo.completed ? 'completed' : ''
      }
    }))
  }
});

/**
 * @param {Object} props
 * @param {JurisContext} context
 * @returns {JurisVDOMElement} 
 */
const ContactForm = (props, context) => ({
  form: {
    onSubmit: (e) => {
      e.preventDefault();
      context.setState('form.submitted', true);
    },
    children: [
      {
        input: {
          type: 'text',
          placeholder: 'Your name',
          value: () => context.getState('form.name', ''),
          onInput: (e) => context.setState('form.name', e.target.value)
        }
      },
      {
        button: {
          type: 'submit',
          text: 'Submit'
        }
      }
    ]
  }
});

Installation

NPM

npm install juris

CDN

<script src="https://unpkg.com/[email protected]/juris.js"></script>

๐Ÿ”ฅ Core State Management (Super Simple!)

/**
 * Gets a value from the application state - REACTIVE MAGIC! โœจ
 * 
 * @param {string} path - Dot-notation path (e.g., 'user.profile.name')
 * @param {any} [defaultValue] - Default value if path doesn't exist
 * @param {boolean} [track=true] - Whether to track for reactivity
 * @returns {any} The state value
 */
getState: (path, defaultValue, track) => any;

/**
 * Sets a value in the application state - INSTANT UPDATES! ๐Ÿš€
 * 
 * @param {string} path - Dot-notation path where to set the value
 * @param {any} value - The value to set
 * @param {any} [context] - Additional context for debugging
 */
setState: (path, value, context) => void;

๐ŸŽจ Element Properties (Beautiful & Reactive!)

๐Ÿงฑ Basic Elements

/**
 * Base properties for all elements - The foundation of AWESOME! ๐Ÿ—๏ธ
 */
const elementProps = {
  id: 'string',
  className: 'string', 
  onClick: () => void, // Touch-optimized for mobile! ๐Ÿ“ฑ
  style: {} // or function returning object - REACTIVE STYLES! ๐Ÿ’ซ
};

/**
 * Element that can contain text, children, or innerHTML - MAXIMUM FLEXIBILITY! ๐Ÿคธ
 */
const containerElement = {
  text: 'string', // or function returning string - LIVE UPDATES!
  children: [], // or function returning array - DYNAMIC LISTS!
  innerHTML: 'string' // or function returning string - RAW POWER!
};

๐Ÿ“ Form Elements (User Input Made Easy!)

/**
 * Input element with form control support - REACTIVE FORMS! โšก
 */
const inputElement = {
  type: 'text', // 'email', 'password', 'number', 'checkbox', 'radio'
  value: 'string', // or function returning value - TWO-WAY BINDING!
  placeholder: 'string',
  onChange: (e) => void, // INSTANT FEEDBACK!
  onInput: (e) => void // REAL-TIME UPDATES!
};

/**
 * Button element - CLICK & ACTION! ๐ŸŽฏ
 */
const buttonElement = {
  type: 'button', // 'submit', 'reset'
  disabled: false, // or function returning boolean - SMART CONTROLS!
  text: 'string', // or function returning string
  children: [] // or function returning array
};

๐ŸŽช Component Context (Everything You Need!)

/**
 * Context object provided to components - YOUR TOOLKIT! ๐Ÿงฐ
 */
const context = {
  getState: (path, defaultValue, track) => any, // STATE ACCESS!
  setState: (path, value, context) => void, // STATE UPDATES!
  services: {}, // available services - DEPENDENCY INJECTION!
  element: HTMLElement, // DOM element if available
  
  /**
   * Creates component-local state - ISOLATED & CLEAN! ๐Ÿงน
   * @param {string} key - Unique key for this state
   * @param {any} initialValue - Initial value
   * @returns {[Function, Function]} Getter and setter functions
   */
  newState: (key, initialValue) => [getter, setter] // LOCAL STATE MAGIC!
};

๐Ÿ—๏ธ Framework Instance (The Powerhouse!)

/**
 * Main Juris framework instance - THE BRAIN! ๐Ÿง 
 */
const juris = {
  getState: (path, defaultValue, track) => any, // GLOBAL STATE!
  setState: (path, value, context) => void, // GLOBAL UPDATES!
  registerComponent: (name, component) => void, // COMPONENT REGISTRY!
  render: (container) => void, // RENDER TO DOM!
  enhance: (selector, definition, options) => unsubscribe // PROGRESSIVE ENHANCEMENT!
};

๐ŸŒŸ Links (Join the Revolution!)


๐ŸŽ‰ Ready to build something AMAZING? Let's go! ๐Ÿš€

โš ๏ธ **GitHub.com Fallback** โš ๏ธ