diff --git a/API/dotpipe.js b/API/dotpipe.js index 59945e8..9bdd707 100644 --- a/API/dotpipe.js +++ b/API/dotpipe.js @@ -79,23 +79,95 @@ * lazy-load For ; enable/disable lazy loading (default true). * * ────────────────────────────────────────────────────────────── - * INLINE MACRO OPERATORS - * - * |&varName:value → Store literal value in dpVars.varName - * !varName → Reference stored variable in function arguments - * |%funcName:[arg1,arg2] → Call function funcName with arguments; supports !varName, #varName, @id.prop - * |$id:varName → Inject variable value into element innerHTML - * |@id.prop:varName → Set DOM element property to variable value - * |#varName:id.prop → Read DOM element property into dpVars.varName - * |nop:varName → Store the last computed value in dpVars.varName - * - * ────────────────────────────────────────────────────────────── - * BUILT-IN VERBS - * - * ajax:url:GET → Fetch URL via AJAX (returns text) - * log:value → Log value to console - * - * ────────────────────────────────────────────────────────────── + * Core Syntax + * |verb:param1:param2 → call a verb with parameters + * !varName → resolve a pipeline variable + * &varName:value → assign a pipeline variable + * |$id.prop:value → set a DOM property/attribute + * + * Shells (scoped pipelines) + * |+targetId:shellName → start a new shell, scoped to element with id=targetId + * - shell variables are isolated until closed + * - shellName is a label for managing + * |-shellName → close shell, merge variables back into parent, discard shell + * + * Example: + * |+crazyStrawOutput:timer1 + * |&n:testing + * |log:!n + * |-timer1 + * + * Variable Handling + * &x:123 → define variable x = "123" + * log:!x → logs "123" in console + * !x.prop → deep resolve object property (if object/JSON) + * + * Example: + * |&user:John + * |log:!user + * + * DOM Binding + * |$id.innerHTML:!var → set innerHTML of element #id + * |$id.value:42 → set form input value + * + * Example: + * |&msg:Hello + * |$status.innerHTML:!msg + * + * Standard Verbs + * log:x → console.log the parameter(s) + * modala:url:targetId → fetch JSON and render into DOM via modala() + * exc:this → send the current clicked element into the pipeline + * exc:someVar → send variable into the pipeline + * nop:x → no-op, passes value through + * + * AJAX & Modala + * → load JSON via modala() + * Or inline: + * |modala:./inline/data.json:crazyStrawOutput + * + * Example Pipeline + *
+ * + * + * + * ------------------------------------------------------- + * |call: Function Invoker + * ------------------------------------------------------- + * Usage: + * |call:fnName:param1:param2:... + * + * Behavior: + * - Looks up a function by name in global scope (window). + * - Resolves each param: + * - "this" → the current clicked/triggered element + * - "!varName" → value from dpVars + * - any other string → literal + * - Calls fnName(...resolvedParams) + * + * Examples: + * |call:highlight:this + * → highlight(elem) with the clicked element. + * + * |&n:42 |call:processValue:!n + * → stores 42 in dpVars.n, then calls processValue(42). + * + * |call:saveData:crazyStrawOutput:Done! + * → saveData("crazyStrawOutput", "Done!") + * + * Notes: + * - Functions must be globally accessible (on window). + * - Works with loose functions, modules (if exported globally), + * or inline + + function processValue(v) { + alert("Processed value → " + v); + } + + + +
+ - + + + + + + + + diff --git a/landing/dotpipe.js b/landing/dotpipe.js index 59945e8..9bdd707 100644 --- a/landing/dotpipe.js +++ b/landing/dotpipe.js @@ -79,23 +79,95 @@ * lazy-load For ; enable/disable lazy loading (default true). * * ────────────────────────────────────────────────────────────── - * INLINE MACRO OPERATORS - * - * |&varName:value → Store literal value in dpVars.varName - * !varName → Reference stored variable in function arguments - * |%funcName:[arg1,arg2] → Call function funcName with arguments; supports !varName, #varName, @id.prop - * |$id:varName → Inject variable value into element innerHTML - * |@id.prop:varName → Set DOM element property to variable value - * |#varName:id.prop → Read DOM element property into dpVars.varName - * |nop:varName → Store the last computed value in dpVars.varName - * - * ────────────────────────────────────────────────────────────── - * BUILT-IN VERBS - * - * ajax:url:GET → Fetch URL via AJAX (returns text) - * log:value → Log value to console - * - * ────────────────────────────────────────────────────────────── + * Core Syntax + * |verb:param1:param2 → call a verb with parameters + * !varName → resolve a pipeline variable + * &varName:value → assign a pipeline variable + * |$id.prop:value → set a DOM property/attribute + * + * Shells (scoped pipelines) + * |+targetId:shellName → start a new shell, scoped to element with id=targetId + * - shell variables are isolated until closed + * - shellName is a label for managing + * |-shellName → close shell, merge variables back into parent, discard shell + * + * Example: + * |+crazyStrawOutput:timer1 + * |&n:testing + * |log:!n + * |-timer1 + * + * Variable Handling + * &x:123 → define variable x = "123" + * log:!x → logs "123" in console + * !x.prop → deep resolve object property (if object/JSON) + * + * Example: + * |&user:John + * |log:!user + * + * DOM Binding + * |$id.innerHTML:!var → set innerHTML of element #id + * |$id.value:42 → set form input value + * + * Example: + * |&msg:Hello + * |$status.innerHTML:!msg + * + * Standard Verbs + * log:x → console.log the parameter(s) + * modala:url:targetId → fetch JSON and render into DOM via modala() + * exc:this → send the current clicked element into the pipeline + * exc:someVar → send variable into the pipeline + * nop:x → no-op, passes value through + * + * AJAX & Modala + * → load JSON via modala() + * Or inline: + * |modala:./inline/data.json:crazyStrawOutput + * + * Example Pipeline + *
+ * + * + * + * ------------------------------------------------------- + * |call: Function Invoker + * ------------------------------------------------------- + * Usage: + * |call:fnName:param1:param2:... + * + * Behavior: + * - Looks up a function by name in global scope (window). + * - Resolves each param: + * - "this" → the current clicked/triggered element + * - "!varName" → value from dpVars + * - any other string → literal + * - Calls fnName(...resolvedParams) + * + * Examples: + * |call:highlight:this + * → highlight(elem) with the clicked element. + * + * |&n:42 |call:processValue:!n + * → stores 42 in dpVars.n, then calls processValue(42). + * + * |call:saveData:crazyStrawOutput:Done! + * → saveData("crazyStrawOutput", "Done!") + * + * Notes: + * - Functions must be globally accessible (on window). + * - Works with loose functions, modules (if exported globally), + * or inline