Refactor jqhtml integration to use jqhtml.boot() and migrate blade highlighting to jqhtml extension

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-11-25 03:33:09 +00:00
parent bd5809fdbd
commit 9be3dfc14e
58 changed files with 817 additions and 672 deletions

View File

@@ -149,13 +149,13 @@ class JqhtmlBladeCompiler
}
// Build HTML attributes string
// Handle class attribute specially to merge with Component_Init
$class_value = 'Component_Init';
// Handle class attribute specially to merge with _Component_Init
$class_value = '_Component_Init';
if (isset($html_attrs['class'])) {
if ($html_attrs['class']['type'] === 'expression') {
$class_value = "Component_Init ' . {$html_attrs['class']['value']} . '";
$class_value = "_Component_Init ' . {$html_attrs['class']['value']} . '";
} else {
$class_value = 'Component_Init ' . $html_attrs['class']['value'];
$class_value = '_Component_Init ' . $html_attrs['class']['value'];
}
}
@@ -229,13 +229,13 @@ class JqhtmlBladeCompiler
}
// Build HTML attributes string
// Handle class attribute specially to merge with Component_Init
$class_value = 'Component_Init';
// Handle class attribute specially to merge with _Component_Init
$class_value = '_Component_Init';
if (isset($html_attrs['class'])) {
if ($html_attrs['class']['type'] === 'expression') {
$class_value = "Component_Init ' . {$html_attrs['class']['value']} . '";
$class_value = "_Component_Init ' . {$html_attrs['class']['value']} . '";
} else {
$class_value = 'Component_Init ' . $html_attrs['class']['value'];
$class_value = '_Component_Init ' . $html_attrs['class']['value'];
}
}

View File

@@ -1,55 +1,26 @@
/**
* JQHTML Integration - Component Hydration System
* JQHTML Integration - Component Registration and Hydration Bootstrap
*
* This module bridges server-rendered HTML and client-side jqhtml components.
*
* == THE HYDRATION PROBLEM ==
*
* When PHP/Blade renders a page, jqhtml components appear as placeholder elements:
*
* Blade source: <User_Card $name="John" />
* Rendered HTML: <div class="Component_Init"
* data-component-init-name="User_Card"
* data-component-args='{"name":"John"}'>
* </div>
*
* These are just div tags - they have no behavior until JavaScript runs.
* "Hydration" is the process of finding these placeholders and converting them
* into live, interactive jqhtml components.
* This module bridges RSpade's manifest system with jqhtml's component runtime.
*
* == TWO-PHASE INITIALIZATION ==
*
* Phase 1: _on_framework_modules_define() - Component Registration
* - Runs early in framework boot, before DOM is processed
* - Registers all ES6 classes extending Component with jqhtml runtime
* - Tags static methods with cache IDs for jqhtml's caching system
* - After this phase, jqhtml knows: "User_Card" → UserCardClass
*
* Phase 2: _on_framework_modules_init() - DOM Hydration
* - Runs after templates are loaded
* - Finds all .Component_Init elements in the DOM
* - Extracts component name and args from data attributes
* - Calls $element.component(name, args) to hydrate each one
* - Recursively processes nested components
* - Calls jqhtml.boot() to hydrate all ._Component_Init placeholders
* - Triggers 'jqhtml_ready' when all components are initialized
*
* == THE TRANSFORMATION ==
*
* Before hydration:
* <div class="Component_Init" data-component-init-name="User_Card" ...>
*
* After hydration:
* <div class="User_Card"> ← Component_Init removed, component class added
* [component template content] ← Template rendered into element
* </div>
*
* The element is now a live component with event handlers, state, and lifecycle.
*
* == KEY PARTICIPANTS ==
*
* JqhtmlBladeCompiler.php - Transforms <Component /> tags into .Component_Init divs
* JqhtmlBladeCompiler.php - Transforms <Component /> tags into ._Component_Init divs
* jqhtml runtime - Maintains registry of component names → classes
* This module - Orchestrates registration and hydration
* $().component() - jQuery plugin that creates component instances
* jqhtml.boot() - Finds and hydrates all ._Component_Init placeholders
* This module - Orchestrates registration and triggers hydration
*/
class Jqhtml_Integration {
/**
@@ -120,165 +91,20 @@ class Jqhtml_Integration {
/**
* Phase 2: DOM Hydration
*
* Finds all .Component_Init placeholders and converts them into live components.
* Delegates to jqhtml.boot() which finds all ._Component_Init placeholders
* and converts them into live components.
*
* == HYDRATION PROCESS ==
*
* For each .Component_Init element:
*
* 1. EXTRACT: Read data-component-init-name and data-component-args
* 2. CLEANUP: Remove data attributes (prevents re-hydration, hides implementation)
* 3. CAPTURE: Save innerHTML for slot/content() processing
* 4. INSTANTIATE: Call $element.component(name, args)
* 5. RECURSE: After render, hydrate any nested .Component_Init elements
*
* == NESTED COMPONENT HANDLING ==
*
* Components can contain other components in their Blade output:
*
* <User_Card> ← Parent hydrates first
* <Avatar /> ← Child hydrates after parent renders
* </User_Card>
*
* We skip nested .Component_Init elements on first pass (they're inside a parent
* that hasn't rendered yet). After each component renders, we recursively scan
* its content for children to hydrate.
*
* == ASYNC COMPLETION ==
*
* Hydration is async because components may have on_load() methods that fetch data.
* We track all component promises and trigger 'jqhtml_ready' only when every
* component (including nested ones) has completed its full lifecycle.
*
* @param {jQuery} [$scope] Scope to search (defaults to body). Recursive calls pass component.$
* @returns {Array<Promise>|undefined} Promises for recursive calls; undefined for top-level
* jqhtml.boot() handles:
* - Finding ._Component_Init elements
* - Parsing data-component-init-name / data-component-args
* - Calling $element.component(name, args)
* - Recursive nested component handling
* - Promise tracking for async components
*/
static _on_framework_modules_init($scope) {
const is_top_level = !$scope;
const promises = [];
const components_needing_init = ($scope || $('body')).find('.Component_Init');
if (components_needing_init.length > 0) {
console_debug('JQHTML_INIT', `Initializing ${components_needing_init.length} DOM components`);
}
components_needing_init.each(function () {
const $element = $(this);
// Guard: Element may have been removed by a parent component's render
if (!document.contains($element[0])) {
return;
}
// Guard: Skip nested components - they'll be processed after their parent renders
let parent = $element[0].parentElement;
while (parent) {
if (parent.classList.contains('Component_Init')) {
return;
}
parent = parent.parentElement;
}
// ─────────────────────────────────────────────────────────────────
// STEP 1: Extract hydration data from placeholder element
// ─────────────────────────────────────────────────────────────────
const component_name = $element.attr('data-component-init-name');
const args_string = $element.attr('data-component-args');
let component_args = {};
if (args_string) {
try {
component_args = JSON.parse(args_string);
} catch (e) {
console.error(`[JQHTML Integration] Failed to parse component args for ${component_name}:`, e);
component_args = {};
}
}
// ─────────────────────────────────────────────────────────────────
// STEP 2: Remove hydration markers (cleanup)
//
// These attributes served their purpose. Removing them:
// - Prevents accidental re-hydration
// - Hides implementation details from DOM inspection
// - Prevents other code from depending on this internal mechanism
// ─────────────────────────────────────────────────────────────────
$element.removeAttr('data-component-init-name');
$element.removeAttr('data-component-args');
$element.removeData('component-init-name');
$element.removeData('component-args');
if (component_name) {
let component_args_filtered = {};
for (const [key, value] of Object.entries(component_args)) {
if (key.startsWith('data-')) {
component_args_filtered[key.substring(5)] = value;
} else {
component_args_filtered[key] = value;
}
}
try {
// ─────────────────────────────────────────────────────────
// STEP 3: Capture innerHTML for slot/content() processing
//
// Blade content between <Component>...</Component> tags
// becomes available to the template via content() function
// ─────────────────────────────────────────────────────────
component_args_filtered._inner_html = $element.html();
$element.empty();
// ─────────────────────────────────────────────────────────
// STEP 4: Instantiate the component
//
// Remove .Component_Init first to prevent re-initialization
// if this element is somehow scanned again
// ─────────────────────────────────────────────────────────
$element.removeClass('Component_Init');
const component_promise = new Promise((resolve) => {
// $().component(name, args) creates the component instance,
// binds it to the element, and starts the lifecycle
let component = $element.component(component_name, component_args_filtered).component();
// ─────────────────────────────────────────────────────
// STEP 5: Recurse after render
//
// Component's template may contain nested .Component_Init
// elements. We must wait for render before we can find them.
//
// Note: If the template changed the tag (e.g., tag="button"),
// the original $element may have been replaced. Always use
// component.$ to get the current element.
// ─────────────────────────────────────────────────────
component.on('render', function () {
const nested_promises = Jqhtml_Integration._on_framework_modules_init(component.$);
promises.push(...nested_promises);
resolve();
}).$;
});
promises.push(component_promise);
} catch (error) {
console.error(`[JQHTML Integration] Failed to initialize component ${component_name}:`, error);
console.error('Error details:', error.stack || error);
}
}
static _on_framework_modules_init() {
jqhtml.boot().then(() => {
Rsx.trigger('jqhtml_ready');
});
// ─────────────────────────────────────────────────────────────────────
// COMPLETION: Top-level call waits for all components, then signals ready
// ─────────────────────────────────────────────────────────────────────
if (is_top_level) {
(async () => {
await Promise.all(promises);
Rsx.trigger('jqhtml_ready');
})();
return;
}
// Recursive calls return promises for parent to collect
return promises;
}
// ═══════════════════════════════════════════════════════════════════════

View File

@@ -1 +0,0 @@
{"version":3,"file":"blade_client.js","sourceRoot":"","sources":["../src/blade_client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAE1B,MAAM,0BAA0B,GAAG,GAAG,EAAE;IAC3C,sDAAsD;IACtD,MAAM,cAAc,GAAa;QAC7B,MAAM;QACN,MAAM;QACN,IAAI;QACJ,KAAK;QACL,OAAO;QACP,IAAI;QACJ,KAAK;QACL,OAAO;QACP,QAAQ;QACR,MAAM;QACN,UAAU;QACV,MAAM;QACN,OAAO;QACP,QAAQ;QACR,OAAO;QACP,KAAK;KACR,CAAC;IAEF,iEAAiE;IACjE,MAAM,CAAC,SAAS,CAAC,wBAAwB,CAAC,OAAO,EAAE;QAC/C,gBAAgB,EAAE;YACd,qBAAqB,EACjB,wJAAwJ;YAC5J,qBAAqB,EACjB,kDAAkD;SACzD;QACD,WAAW,EACP,gFAAgF;QACpF,YAAY,EAAE;YACV;gBACI,oEAAoE;gBACpE,UAAU,EAAE,IAAI,MAAM,CAClB,UAAU,cAAc,CAAC,IAAI,CACzB,GAAG,CACN,8CAA8C,EAC/C,GAAG,CACN;gBACD,SAAS,EAAE,+BAA+B;gBAC1C,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC,aAAa,EAAE;aAC9D;YACD;gBACI,qDAAqD;gBACrD,UAAU,EAAE,IAAI,MAAM,CAClB,UAAU,cAAc,CAAC,IAAI,CACzB,GAAG,CACN,sCAAsC,EACvC,GAAG,CACN;gBACD,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE;aACvD;SACJ;KACJ,CAAC,CAAC;AACP,CAAC,CAAC;AAvDW,QAAA,0BAA0B,8BAuDrC"}

View File

@@ -1,81 +0,0 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BladeComponentSemanticTokensProvider = void 0;
const vscode = __importStar(require("vscode"));
/**
* Provides semantic tokens for uppercase component tags in Blade files
* Highlights component tag names in light green
* Highlights tag="" attribute in orange on jqhtml components
*/
class BladeComponentSemanticTokensProvider {
async provideDocumentSemanticTokens(document) {
const tokens_builder = new vscode.SemanticTokensBuilder();
if (document.languageId !== 'blade') {
return tokens_builder.build();
}
const text = document.getText();
// Match opening tags that start with uppercase letter to find jqhtml components
// Matches: <ComponentName ...>, captures the entire tag up to >
const component_tag_regex = /<([A-Z][a-zA-Z0-9_]*)([^>]*?)>/g;
let component_match;
while ((component_match = component_tag_regex.exec(text)) !== null) {
const tag_name = component_match[1];
const tag_attributes = component_match[2];
const tag_start = component_match.index + component_match[0].indexOf(tag_name);
const tag_position = document.positionAt(tag_start);
// Push token for the component tag name
// Token type 0 maps to 'class' which VS Code themes style as entity.name.class (turquoise/cyan)
tokens_builder.push(tag_position.line, tag_position.character, tag_name.length, 0, 0);
// Now look for tag="" attribute within this component's attributes
// Matches: tag="..." or tag='...'
const tag_attr_regex = /\btag\s*=/g;
let attr_match;
while ((attr_match = tag_attr_regex.exec(tag_attributes)) !== null) {
// Calculate the position of 'tag' within the document
const attr_start = component_match.index + component_match[0].indexOf(tag_attributes) + attr_match.index;
const attr_position = document.positionAt(attr_start);
// Push token for 'tag' attribute name
// Token type 1 maps to 'jqhtmlTagAttribute' which we'll define to be orange
tokens_builder.push(attr_position.line, attr_position.character, 3, 1, 0);
}
}
// Also match closing tags that start with uppercase letter
// Matches: </ComponentName>
const closing_tag_regex = /<\/([A-Z][a-zA-Z0-9_]*)/g;
let closing_match;
while ((closing_match = closing_tag_regex.exec(text)) !== null) {
const tag_name = closing_match[1];
const tag_start = closing_match.index + closing_match[0].indexOf(tag_name);
const position = document.positionAt(tag_start);
// Push token for the tag name
// Token type 0 maps to 'class' which VS Code themes style as entity.name.class (turquoise/cyan)
tokens_builder.push(position.line, position.character, tag_name.length, 0, 0);
}
return tokens_builder.build();
}
}
exports.BladeComponentSemanticTokensProvider = BladeComponentSemanticTokensProvider;
//# sourceMappingURL=blade_component_provider.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"blade_component_provider.js","sourceRoot":"","sources":["../src/blade_component_provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAEjC;;;;GAIG;AACH,MAAa,oCAAoC;IAC7C,KAAK,CAAC,6BAA6B,CAAC,QAA6B;QAC7D,MAAM,cAAc,GAAG,IAAI,MAAM,CAAC,qBAAqB,EAAE,CAAC;QAE1D,IAAI,QAAQ,CAAC,UAAU,KAAK,OAAO,EAAE;YACjC,OAAO,cAAc,CAAC,KAAK,EAAE,CAAC;SACjC;QAED,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAC;QAEhC,gFAAgF;QAChF,gEAAgE;QAChE,MAAM,mBAAmB,GAAG,iCAAiC,CAAC;QAC9D,IAAI,eAAe,CAAC;QAEpB,OAAO,CAAC,eAAe,GAAG,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,EAAE;YAChE,MAAM,QAAQ,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;YACpC,MAAM,cAAc,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;YAC1C,MAAM,SAAS,GAAG,eAAe,CAAC,KAAK,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,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AE,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAC7D,CAAC;gBACF,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;aACxC;SACJ;IACL,CAAC,CAAC,CAAC;IAEH,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,EAAE;QACzC,MAAM,CAAC,aAAa,CAAC,IAAI,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;KAC9E;AACL,CAAC,CAAC;AAtEW,QAAA,YAAY,gBAsEvB"}

View File

@@ -44,11 +44,6 @@
"type": "string",
"default": "",
"description": "Set to 'rspade' to enable RSpade framework features"
},
"rspade.enableBladeAutoSpacing": {
"type": "boolean",
"default": true,
"description": "Automatically add spaces inside Blade tags when typing"
}
}
},
@@ -109,26 +104,19 @@
"id": "conventionMethod",
"superType": "method",
"description": "Convention method automatically called by RSX framework"
},
{
"id": "jqhtmlTagAttribute",
"superType": "parameter",
"description": "The tag attribute on jqhtml components"
}
],
"semanticTokenScopes": [
{
"scopes": {
"conventionMethod": ["entity.name.function.convention.rspade"],
"jqhtmlTagAttribute": ["entity.other.attribute-name.jqhtml.tag"]
"conventionMethod": ["entity.name.function.convention.rspade"]
}
}
],
"configurationDefaults": {
"editor.semanticTokenColorCustomizations": {
"rules": {
"conventionMethod": "#FFA500",
"jqhtmlTagAttribute": "#FFA500"
"conventionMethod": "#FFA500"
}
}
}

View File

@@ -1,58 +0,0 @@
import * as vscode from 'vscode';
export const init_blade_language_config = () => {
// HTML empty elements that don't require closing tags
const EMPTY_ELEMENTS: string[] = [
'area',
'base',
'br',
'col',
'embed',
'hr',
'img',
'input',
'keygen',
'link',
'menuitem',
'meta',
'param',
'source',
'track',
'wbr',
];
// Configure Blade language indentation and auto-closing behavior
vscode.languages.setLanguageConfiguration('blade', {
indentationRules: {
increaseIndentPattern:
/<(?!\?|(?:area|base|br|col|frame|hr|html|img|input|link|meta|param)\b|[^>]*\/>)([-_\.A-Za-z0-9]+)(?=\s|>)\b[^>]*>(?!.*<\/\1>)|<!--(?!.*-->)|\{[^}"']*$/,
decreaseIndentPattern:
/^\s*(<\/(?!html)[-_\.A-Za-z0-9]+\b[^>]*>|-->|\})/,
},
wordPattern:
/(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,
onEnterRules: [
{
// When pressing Enter between opening and closing tags, auto-indent
beforeText: new RegExp(
`<(?!(?:${EMPTY_ELEMENTS.join(
'|'
)}))([_:\\w][_:\\w-.\\d]*)([^/>]*(?!/)>)[^<]*$`,
'i'
),
afterText: /^<\/([_:\w][_:\w-.\d]*)\s*>$/i,
action: { indentAction: vscode.IndentAction.IndentOutdent },
},
{
// When pressing Enter after opening tag, auto-indent
beforeText: new RegExp(
`<(?!(?:${EMPTY_ELEMENTS.join(
'|'
)}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,
'i'
),
action: { indentAction: vscode.IndentAction.Indent },
},
],
});
};

View File

@@ -1,66 +0,0 @@
import * as vscode from 'vscode';
/**
* Provides semantic tokens for uppercase component tags in Blade files
* Highlights component tag names in light green
* Highlights tag="" attribute in orange on jqhtml components
*/
export class BladeComponentSemanticTokensProvider implements vscode.DocumentSemanticTokensProvider {
async provideDocumentSemanticTokens(document: vscode.TextDocument): Promise<vscode.SemanticTokens> {
const tokens_builder = new vscode.SemanticTokensBuilder();
if (document.languageId !== 'blade') {
return tokens_builder.build();
}
const text = document.getText();
// Match opening tags that start with uppercase letter to find jqhtml components
// Matches: <ComponentName ...>, captures the entire tag up to >
const component_tag_regex = /<([A-Z][a-zA-Z0-9_]*)([^>]*?)>/g;
let component_match;
while ((component_match = component_tag_regex.exec(text)) !== null) {
const tag_name = component_match[1];
const tag_attributes = component_match[2];
const tag_start = component_match.index + component_match[0].indexOf(tag_name);
const tag_position = document.positionAt(tag_start);
// Push token for the component tag name
// Token type 0 maps to 'class' which VS Code themes style as entity.name.class (turquoise/cyan)
tokens_builder.push(tag_position.line, tag_position.character, tag_name.length, 0, 0);
// Now look for tag="" attribute within this component's attributes
// Matches: tag="..." or tag='...'
const tag_attr_regex = /\btag\s*=/g;
let attr_match;
while ((attr_match = tag_attr_regex.exec(tag_attributes)) !== null) {
// Calculate the position of 'tag' within the document
const attr_start = component_match.index + component_match[0].indexOf(tag_attributes) + attr_match.index;
const attr_position = document.positionAt(attr_start);
// Push token for 'tag' attribute name
// Token type 1 maps to 'jqhtmlTagAttribute' which we'll define to be orange
tokens_builder.push(attr_position.line, attr_position.character, 3, 1, 0);
}
}
// Also match closing tags that start with uppercase letter
// Matches: </ComponentName>
const closing_tag_regex = /<\/([A-Z][a-zA-Z0-9_]*)/g;
let closing_match;
while ((closing_match = closing_tag_regex.exec(text)) !== null) {
const tag_name = closing_match[1];
const tag_start = closing_match.index + closing_match[0].indexOf(tag_name);
const position = document.positionAt(tag_start);
// Push token for the tag name
// Token type 0 maps to 'class' which VS Code themes style as entity.name.class (turquoise/cyan)
tokens_builder.push(position.line, position.character, tag_name.length, 0, 0);
}
return tokens_builder.build();
}
}

View File

@@ -1,122 +0,0 @@
import * as vscode from 'vscode';
import { get_config } from './config';
const TAG_DOUBLE = 0;
const TAG_UNESCAPED = 1;
const TAG_COMMENT = 2;
const snippets: Record<number, string> = {
[TAG_DOUBLE]: '{{ ${1:${TM_SELECTED_TEXT/[{}]//g}} }}$0',
[TAG_UNESCAPED]: '{!! ${1:${TM_SELECTED_TEXT/[{} !]//g}} !!}$0',
[TAG_COMMENT]: '{{-- ${1:${TM_SELECTED_TEXT/(--)|[{} ]//g}} --}}$0',
};
const triggers = ['{}', '!', '-', '{'];
const regexes = [
/({{(?!\s|-))(.*?)(}})/,
/({!!(?!\s))(.*?)?(}?)/,
/({{[\s]?--)(.*?)?(}})/,
];
const translate = (position: vscode.Position, offset: number): vscode.Position => {
try {
return position.translate(0, offset);
} catch (error) {
// VS Code doesn't like negative numbers passed
// to translate (even though it works fine), so
// this block prevents debug console errors
}
return position;
};
const chars_for_change = (
doc: vscode.TextDocument,
change: vscode.TextDocumentContentChangeEvent
): number => {
if (change.text === '!') {
return 2;
}
if (change.text !== '-') {
return 1;
}
const start = translate(change.range.start, -2);
const end = translate(change.range.start, -1);
return doc.getText(new vscode.Range(start, end)) === ' ' ? 4 : 3;
};
export const blade_spacer = async (
e: vscode.TextDocumentChangeEvent,
editor?: vscode.TextEditor
) => {
const config = get_config();
if (
!config.get('enableBladeAutoSpacing', true) ||
!editor ||
editor.document.fileName.indexOf('.blade.php') === -1
) {
return;
}
let tag_type: number = -1;
let ranges: vscode.Range[] = [];
let offsets: number[] = [];
// Changes (per line) come in right-to-left when we need them left-to-right
const changes = e.contentChanges.slice().reverse();
changes.forEach((change) => {
if (triggers.indexOf(change.text) === -1) {
return;
}
if (!offsets[change.range.start.line]) {
offsets[change.range.start.line] = 0;
}
const start_offset =
offsets[change.range.start.line] -
chars_for_change(e.document, change);
const start = translate(change.range.start, start_offset);
const line_end = e.document.lineAt(start.line).range.end;
for (let i = 0; i < regexes.length; i++) {
// If we typed a - or a !, don't consider the "double" tag type
if (i === TAG_DOUBLE && ['-', '!'].indexOf(change.text) !== -1) {
continue;
}
// Only look at unescaped tags if we need to
if (i === TAG_UNESCAPED && change.text !== '!') {
continue;
}
// Only look at comment tags if we need to
if (i === TAG_COMMENT && change.text !== '-') {
continue;
}
const tag = regexes[i].exec(
e.document.getText(new vscode.Range(start, line_end))
);
if (tag) {
tag_type = i;
ranges.push(
new vscode.Range(start, start.translate(0, tag[0].length))
);
offsets[start.line] += tag[1].length;
}
}
});
if (ranges.length > 0 && snippets[tag_type]) {
editor.insertSnippet(new vscode.SnippetString(snippets[tag_type]), ranges);
}
};

View File

@@ -7,14 +7,11 @@ import { RspadeDefinitionProvider } from './definition_provider';
import { DebugClient } from './debug_client';
import { get_config } from './config';
import { LaravelCompletionProvider } from './laravel_completion_provider';
import { blade_spacer } from './blade_spacer';
import { init_blade_language_config } from './blade_client';
import { ConventionMethodHoverProvider, ConventionMethodDiagnosticProvider, ConventionMethodDefinitionProvider } from './convention_method_provider';
import { CommentFileReferenceDefinitionProvider } from './comment_file_reference_provider';
import { JqhtmlLifecycleHoverProvider, JqhtmlLifecycleDiagnosticProvider } from './jqhtml_lifecycle_provider';
import { CombinedSemanticTokensProvider } from './combined_semantic_provider';
import { PhpAttributeSemanticTokensProvider } from './php_attribute_provider';
import { BladeComponentSemanticTokensProvider } from './blade_component_provider';
import { AutoRenameProvider } from './auto_rename_provider';
import { FolderColorProvider } from './folder_color_provider';
import { GitStatusProvider } from './git_status_provider';
@@ -255,18 +252,6 @@ export async function activate(context: vscode.ExtensionContext) {
console.log('RSpade formatter registered for PHP files');
// Initialize Blade language configuration (indentation, auto-closing)
init_blade_language_config();
console.log('Blade language configuration initialized');
// Register Blade auto-spacing on text change
context.subscriptions.push(
vscode.workspace.onDidChangeTextDocument((event) => {
blade_spacer(event, vscode.window.activeTextEditor);
})
);
console.log('Blade auto-spacing enabled');
// Register definition provider for JavaScript/TypeScript and PHP/Blade/jqhtml files
context.subscriptions.push(
vscode.languages.registerDefinitionProvider(
@@ -372,19 +357,6 @@ export async function activate(context: vscode.ExtensionContext) {
console.log('PHP attribute provider registered for PHP files');
// Register Blade component provider for uppercase component tags
const blade_component_provider = new BladeComponentSemanticTokensProvider();
context.subscriptions.push(
vscode.languages.registerDocumentSemanticTokensProvider(
[{ language: 'blade' }, { pattern: '**/*.blade.php' }],
blade_component_provider,
new vscode.SemanticTokensLegend(['class', 'jqhtmlTagAttribute'])
)
);
console.log('Blade component provider registered for Blade files');
// Debug client disabled
// debug_client = new DebugClient(formatting_provider as any);
// debug_client.start().catch(error => {

38
node_modules/.package-lock.json generated vendored
View File

@@ -2211,9 +2211,9 @@
}
},
"node_modules/@jqhtml/core": {
"version": "2.2.222",
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/core/-/core-2.2.222.tgz",
"integrity": "sha512-cO5iO9VjHqeOZhdz+WD0rCb+mvS2U6eHMWRrkrTS4F3RmYrUOPk+8KUpeWUXkND4D+JnK9iMmLWY1+WjQHDVFQ==",
"version": "2.3.4",
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/core/-/core-2.3.4.tgz",
"integrity": "sha512-RQLviu8NcIxrnd1cUOE8HNPmwWT/kVliwHl91zqYaYw3cXstF2PG9OxbRtiUWAdbOxuqJSLkELrXLG+4cr1o9w==",
"license": "MIT",
"dependencies": {
"@rollup/plugin-node-resolve": "^16.0.1",
@@ -2237,9 +2237,9 @@
}
},
"node_modules/@jqhtml/parser": {
"version": "2.2.222",
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/parser/-/parser-2.2.222.tgz",
"integrity": "sha512-jEF+HfOMRwkZ9lVWO7+wKMKDXsI51R5g0qq2trqTXAOs2aNnDtrJV9yqY1LWXMdi1h2iV5AJhbkvAZS1p9gzSw==",
"version": "2.3.4",
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/parser/-/parser-2.3.4.tgz",
"integrity": "sha512-jFc7RtmxMdt8ewJmuq6lw74c3dMHqaZ9BXUX3czwtU4w1ZxkLkppEhTmrm+wtQ7/rdK6jsfvL4W++wrXQtoclA==",
"license": "MIT",
"dependencies": {
"@types/jest": "^29.5.11",
@@ -2277,21 +2277,21 @@
}
},
"node_modules/@jqhtml/vscode-extension": {
"version": "2.2.222",
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/vscode-extension/-/vscode-extension-2.2.222.tgz",
"integrity": "sha512-o5WAF3JMgMjORImpCvS5yCSnduS1iQJOjzNDjHMzFglZIB1lfyzq9VV7n3ykQVLmRUBB3p1tyPUe6R08b+7Txw==",
"version": "2.3.4",
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/vscode-extension/-/vscode-extension-2.3.4.tgz",
"integrity": "sha512-AU3M2yD4tiGKcfkW2cBtO26yKzdJj5+Af1BBoblnr1zqPzlTyLaZapoLPL/bEpSwnaFB5I3XqKuBj2sKSDE30Q==",
"license": "MIT",
"engines": {
"vscode": "^1.74.0"
}
},
"node_modules/@jqhtml/webpack-loader": {
"version": "2.2.222",
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/webpack-loader/-/webpack-loader-2.2.222.tgz",
"integrity": "sha512-6ucNvup5MJ9w6UCjL6nvKKRHfrCipqC0qLApxeTToQROY/16vZ/YbLj4ZgzsrUfu656bSYlcWG/OBrUfxUZnog==",
"version": "2.3.4",
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/webpack-loader/-/webpack-loader-2.3.4.tgz",
"integrity": "sha512-QYanMVtRQ6Y5Xuw/AfZFdbSwMWnLBKo53/mpQtOEqdY1+cMCcbt/C3oxz8fJaCzAXWmxOZVqxU7kNxZ1YihRtQ==",
"license": "MIT",
"dependencies": {
"@jqhtml/parser": "2.2.222",
"@jqhtml/parser": "2.3.4",
"@types/loader-utils": "^2.0.6",
"@types/node": "^20.0.0",
"@types/webpack": "^5.28.5",
@@ -4395,9 +4395,9 @@
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001756",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001756.tgz",
"integrity": "sha512-4HnCNKbMLkLdhJz3TToeVWHSnfJvPaq6vu/eRP0Ahub/07n484XHhBF5AJoSGHdVrS8tKFauUQz8Bp9P7LVx7A==",
"version": "1.0.30001757",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001757.tgz",
"integrity": "sha512-r0nnL/I28Zi/yjk1el6ilj27tKcdjLsNqAOZr0yVjWPrSQyHgKI2INaEWw21bAQSv2LXRt1XuCS/GomNpWOxsQ==",
"funding": [
{
"type": "opencollective",
@@ -5657,9 +5657,9 @@
"license": "MIT"
},
"node_modules/electron-to-chromium": {
"version": "1.5.259",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.259.tgz",
"integrity": "sha512-I+oLXgpEJzD6Cwuwt1gYjxsDmu/S/Kd41mmLA3O+/uH2pFRO/DvOjUyGozL8j3KeLV6WyZ7ssPwELMsXCcsJAQ==",
"version": "1.5.260",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.260.tgz",
"integrity": "sha512-ov8rBoOBhVawpzdre+Cmz4FB+y66Eqrk6Gwqd8NGxuhv99GQ8XqMAr351KEkOt7gukXWDg6gJWEMKgL2RLMPtA==",
"license": "ISC"
},
"node_modules/elliptic": {

20
node_modules/@jqhtml/core/dist/boot.d.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
/**
* JQHTML Boot - Component Hydration System
*
* Bridges server-rendered HTML and client-side jqhtml components.
*
* Server output: <div class="_Component_Init" data-component-init-name="User_Card" data-component-args='{"id":1}'></div>
* After boot(): <div class="User_Card Component">...rendered template...</div>
*
* Usage:
* await jqhtml.boot(); // Hydrate all placeholders, wait for ready
* jqhtml.boot($('#container')); // Hydrate within scope
*/
/**
* Hydrate all _Component_Init placeholders within a scope.
*
* @param scope - jQuery object, HTMLElement, or undefined (defaults to body)
* @returns Promise that resolves when all components (including nested) are ready
*/
export declare function boot(scope?: any): Promise<void[]>;
//# sourceMappingURL=boot.d.ts.map

1
node_modules/@jqhtml/core/dist/boot.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"boot.d.ts","sourceRoot":"","sources":["../src/boot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAiDjD"}

View File

@@ -1 +1 @@
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../src/component.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAUH,OAAO,CAAC,MAAM,CAAC;I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C,gBAAgB;IAcxB;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IA+BzB,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,UAAU;IAUlB;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,0BAA0B;CAqEnC"}

View File

@@ -1852,6 +1852,14 @@ class Jqhtml_Component {
* @private
*/
async _wait_for_children_ready() {
// Server-rendered components (created via jqhtml.boot()) may have children
// that were hydrated asynchronously during the 'render' event callback.
// Those children couldn't register via _find_dom_parent() because they were
// created after the parent's lifecycle started. Force DOM traversal fallback
// to reliably discover all children, including boot-hydrated ones.
if (this.args._inner_html !== undefined) {
this._use_dom_fallback = true;
}
const children = this._get_dom_children();
if (children.length === 0) {
return; // No children, nothing to wait for
@@ -2957,6 +2965,136 @@ function escape_html(str) {
return div.innerHTML;
}
/**
* JQHTML Boot - Component Hydration System
*
* Bridges server-rendered HTML and client-side jqhtml components.
*
* Server output: <div class="_Component_Init" data-component-init-name="User_Card" data-component-args='{"id":1}'></div>
* After boot(): <div class="User_Card Component">...rendered template...</div>
*
* Usage:
* await jqhtml.boot(); // Hydrate all placeholders, wait for ready
* jqhtml.boot($('#container')); // Hydrate within scope
*/
/**
* Hydrate all _Component_Init placeholders within a scope.
*
* @param scope - jQuery object, HTMLElement, or undefined (defaults to body)
* @returns Promise that resolves when all components (including nested) are ready
*/
function boot(scope) {
const jQ = typeof jQuery !== 'undefined' ? jQuery : $;
if (!scope) {
scope = jQ('body');
}
else if (!(scope instanceof jQ)) {
scope = jQ(scope);
}
const readyPromises = [];
// Find top-level placeholders only (skip those nested inside other placeholders)
scope.find('._Component_Init').each(function () {
const $element = jQ(this);
// Skip if removed from DOM
if (!document.contains($element[0])) {
return;
}
// Skip nested placeholders - they'll be hydrated by parent's render callback
let parent = $element[0].parentElement;
while (parent) {
if (parent.classList.contains('_Component_Init')) {
return;
}
parent = parent.parentElement;
}
// Hydrate this placeholder
const component = hydrateElement($element);
if (!component)
return;
// On render, recursively hydrate any nested placeholders
component.on('render', function () {
hydrateNested(component.$, jQ);
});
// Collect ready promise - parent.ready() waits for all children via _wait_for_children_ready()
readyPromises.push(component.ready());
});
// Fire jqhtml:ready event when all top-level components are ready
const result = Promise.all(readyPromises);
result.then(() => {
document.dispatchEvent(new CustomEvent('jqhtml:ready'));
});
return result;
}
/**
* Hydrate nested _Component_Init placeholders within a component's DOM.
* Called from parent's 'render' event.
*/
function hydrateNested($scope, jQ) {
$scope.find('._Component_Init').each(function () {
const $element = jQ(this);
if (!document.contains($element[0])) {
return;
}
// Skip if nested inside another placeholder
let parent = $element[0].parentElement;
while (parent && parent !== $scope[0]) {
if (parent.classList.contains('_Component_Init')) {
return;
}
parent = parent.parentElement;
}
const component = hydrateElement($element);
if (!component)
return;
// Recursively handle deeper nesting
component.on('render', function () {
hydrateNested(component.$, jQ);
});
});
}
/**
* Hydrate a single _Component_Init element into a live component.
*/
function hydrateElement($element, jQ) {
const componentName = $element.attr('data-component-init-name');
if (!componentName)
return null;
// Parse args
const argsString = $element.attr('data-component-args');
let args = {};
if (argsString) {
try {
args = JSON.parse(argsString);
}
catch (e) {
console.error(`[jqhtml.boot] Failed to parse args for ${componentName}:`, e);
}
}
// Strip data- prefix from args if present
const filteredArgs = {};
for (const [key, value] of Object.entries(args)) {
filteredArgs[key.startsWith('data-') ? key.substring(5) : key] = value;
}
// Capture innerHTML for content() and mark as boot-created
filteredArgs._inner_html = $element.html();
filteredArgs._component_name = componentName;
// Cleanup placeholder
$element.removeAttr('data-component-init-name');
$element.removeAttr('data-component-args');
$element.removeData('component-init-name');
$element.removeData('component-args');
$element.removeClass('_Component_Init');
$element.empty();
// Create component
try {
return $element.component(componentName, filteredArgs).component();
}
catch (error) {
console.error(`[jqhtml.boot] Failed to create ${componentName}:`, error);
return null;
}
}
/**
* JQHTML Debug Overlay
*
@@ -4237,7 +4375,7 @@ function init(jQuery) {
}
}
// Version - will be replaced during build with actual version from package.json
const version = '2.2.222';
const version = '2.3.4';
// Default export with all functionality
const jqhtml = {
// Core
@@ -4329,7 +4467,9 @@ const jqhtml = {
// Cache key setter - enables component caching via local storage
set_cache_key(cache_key) {
Jqhtml_Local_Storage.set_cache_key(cache_key);
}
},
// Boot - hydrate server-rendered component placeholders
boot
};
// Auto-register on window for browser environments
// This is REQUIRED for compiled templates which use window.jqhtml.register_template()
@@ -4354,6 +4494,7 @@ exports.Jqhtml_Local_Storage = Jqhtml_Local_Storage;
exports.LifecycleManager = LifecycleManager;
exports.Load_Coordinator = Load_Coordinator;
exports.applyDebugDelay = applyDebugDelay;
exports.boot = boot;
exports.create_component = create_component;
exports.default = jqhtml;
exports.devWarn = devWarn;

File diff suppressed because one or more lines are too long

View File

@@ -11,6 +11,7 @@ export type { ComponentConstructor, TemplateFunction, TemplateDefinition } from
export { process_instructions, extract_slots } from './instruction-processor.js';
export type { Instruction, TagInstruction, ComponentInstruction, SlotInstruction } from './instruction-processor.js';
export { render_template, escape_html } from './template-renderer.js';
export { boot } from './boot.js';
export { logLifecycle, applyDebugDelay, logDispatch, logInstruction, logDataChange, isSequentialProcessing, handleComponentError, devWarn } from './debug.js';
export { DebugOverlay, showDebugOverlay, hideDebugOverlay } from './debug-overlay.js';
export type { DebugOverlayOptions } from './debug-overlay.js';
@@ -23,6 +24,7 @@ import { LifecycleManager } from './lifecycle-manager.js';
import { register_component, get_component_class, register_template, get_template, get_template_by_class, create_component, has_component, get_component_names, get_registered_templates, list_components } from './component-registry.js';
import { process_instructions, extract_slots } from './instruction-processor.js';
import { render_template, escape_html } from './template-renderer.js';
import { boot } from './boot.js';
import { DebugOverlay } from './debug-overlay.js';
import './jquery-plugin.js';
import { Jqhtml_Local_Storage } from './local-storage.js';
@@ -86,6 +88,7 @@ declare const jqhtml: {
_version(): any;
version(): string;
set_cache_key(cache_key: string): void;
boot: typeof boot;
};
export default jqhtml;
//# sourceMappingURL=index.d.ts.map

View File

@@ -1 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":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rC,MAAM,WAAW,aAAa;IAE5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAG7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAG/B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE;QACZ,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IAGF,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAGD,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;WA8BL,aAAa,GAAG;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE;+BAGhC,aAAa;4BAIjB,OAAO,GAAG,MAAM;;+BAmBZ,GAAG;;;;;;6BA+CL,MAAM;;CAMhC,CAAC;AAmBF,eAAe,MAAM,CAAC"}

View File

@@ -1848,6 +1848,14 @@ class Jqhtml_Component {
* @private
*/
async _wait_for_children_ready() {
// Server-rendered components (created via jqhtml.boot()) may have children
// that were hydrated asynchronously during the 'render' event callback.
// Those children couldn't register via _find_dom_parent() because they were
// created after the parent's lifecycle started. Force DOM traversal fallback
// to reliably discover all children, including boot-hydrated ones.
if (this.args._inner_html !== undefined) {
this._use_dom_fallback = true;
}
const children = this._get_dom_children();
if (children.length === 0) {
return; // No children, nothing to wait for
@@ -2953,6 +2961,136 @@ function escape_html(str) {
return div.innerHTML;
}
/**
* JQHTML Boot - Component Hydration System
*
* Bridges server-rendered HTML and client-side jqhtml components.
*
* Server output: <div class="_Component_Init" data-component-init-name="User_Card" data-component-args='{"id":1}'></div>
* After boot(): <div class="User_Card Component">...rendered template...</div>
*
* Usage:
* await jqhtml.boot(); // Hydrate all placeholders, wait for ready
* jqhtml.boot($('#container')); // Hydrate within scope
*/
/**
* Hydrate all _Component_Init placeholders within a scope.
*
* @param scope - jQuery object, HTMLElement, or undefined (defaults to body)
* @returns Promise that resolves when all components (including nested) are ready
*/
function boot(scope) {
const jQ = typeof jQuery !== 'undefined' ? jQuery : $;
if (!scope) {
scope = jQ('body');
}
else if (!(scope instanceof jQ)) {
scope = jQ(scope);
}
const readyPromises = [];
// Find top-level placeholders only (skip those nested inside other placeholders)
scope.find('._Component_Init').each(function () {
const $element = jQ(this);
// Skip if removed from DOM
if (!document.contains($element[0])) {
return;
}
// Skip nested placeholders - they'll be hydrated by parent's render callback
let parent = $element[0].parentElement;
while (parent) {
if (parent.classList.contains('_Component_Init')) {
return;
}
parent = parent.parentElement;
}
// Hydrate this placeholder
const component = hydrateElement($element);
if (!component)
return;
// On render, recursively hydrate any nested placeholders
component.on('render', function () {
hydrateNested(component.$, jQ);
});
// Collect ready promise - parent.ready() waits for all children via _wait_for_children_ready()
readyPromises.push(component.ready());
});
// Fire jqhtml:ready event when all top-level components are ready
const result = Promise.all(readyPromises);
result.then(() => {
document.dispatchEvent(new CustomEvent('jqhtml:ready'));
});
return result;
}
/**
* Hydrate nested _Component_Init placeholders within a component's DOM.
* Called from parent's 'render' event.
*/
function hydrateNested($scope, jQ) {
$scope.find('._Component_Init').each(function () {
const $element = jQ(this);
if (!document.contains($element[0])) {
return;
}
// Skip if nested inside another placeholder
let parent = $element[0].parentElement;
while (parent && parent !== $scope[0]) {
if (parent.classList.contains('_Component_Init')) {
return;
}
parent = parent.parentElement;
}
const component = hydrateElement($element);
if (!component)
return;
// Recursively handle deeper nesting
component.on('render', function () {
hydrateNested(component.$, jQ);
});
});
}
/**
* Hydrate a single _Component_Init element into a live component.
*/
function hydrateElement($element, jQ) {
const componentName = $element.attr('data-component-init-name');
if (!componentName)
return null;
// Parse args
const argsString = $element.attr('data-component-args');
let args = {};
if (argsString) {
try {
args = JSON.parse(argsString);
}
catch (e) {
console.error(`[jqhtml.boot] Failed to parse args for ${componentName}:`, e);
}
}
// Strip data- prefix from args if present
const filteredArgs = {};
for (const [key, value] of Object.entries(args)) {
filteredArgs[key.startsWith('data-') ? key.substring(5) : key] = value;
}
// Capture innerHTML for content() and mark as boot-created
filteredArgs._inner_html = $element.html();
filteredArgs._component_name = componentName;
// Cleanup placeholder
$element.removeAttr('data-component-init-name');
$element.removeAttr('data-component-args');
$element.removeData('component-init-name');
$element.removeData('component-args');
$element.removeClass('_Component_Init');
$element.empty();
// Create component
try {
return $element.component(componentName, filteredArgs).component();
}
catch (error) {
console.error(`[jqhtml.boot] Failed to create ${componentName}:`, error);
return null;
}
}
/**
* JQHTML Debug Overlay
*
@@ -4233,7 +4371,7 @@ function init(jQuery) {
}
}
// Version - will be replaced during build with actual version from package.json
const version = '2.2.222';
const version = '2.3.4';
// Default export with all functionality
const jqhtml = {
// Core
@@ -4325,7 +4463,9 @@ const jqhtml = {
// Cache key setter - enables component caching via local storage
set_cache_key(cache_key) {
Jqhtml_Local_Storage.set_cache_key(cache_key);
}
},
// Boot - hydrate server-rendered component placeholders
boot
};
// Auto-register on window for browser environments
// This is REQUIRED for compiled templates which use window.jqhtml.register_template()
@@ -4343,5 +4483,5 @@ if (typeof window !== 'undefined' && !window.jqhtml) {
}
}
export { DebugOverlay, Jqhtml_Component, LifecycleManager as Jqhtml_LifecycleManager, Jqhtml_Local_Storage, LifecycleManager, Load_Coordinator, applyDebugDelay, create_component, jqhtml as default, devWarn, escape_html, extract_slots, get_component_class, get_component_names, get_registered_templates, get_template, get_template_by_class, handleComponentError, has_component, hideDebugOverlay, init, init_jquery_plugin, isSequentialProcessing, list_components, logDataChange, logDispatch, logInstruction, logLifecycle, process_instructions, register_component, register_template, render_template, showDebugOverlay, version };
export { DebugOverlay, Jqhtml_Component, LifecycleManager as Jqhtml_LifecycleManager, Jqhtml_Local_Storage, LifecycleManager, Load_Coordinator, applyDebugDelay, boot, create_component, jqhtml as default, devWarn, escape_html, extract_slots, get_component_class, get_component_names, get_registered_templates, get_template, get_template_by_class, handleComponentError, has_component, hideDebugOverlay, init, init_jquery_plugin, isSequentialProcessing, list_components, logDataChange, logDispatch, logInstruction, logLifecycle, process_instructions, register_component, register_template, render_template, showDebugOverlay, version };
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,5 @@
/**
* JQHTML Core v2.2.222
* JQHTML Core v2.3.4
* (c) 2025 JQHTML Team
* Released under the MIT License
*/
@@ -1853,6 +1853,14 @@ class Jqhtml_Component {
* @private
*/
async _wait_for_children_ready() {
// Server-rendered components (created via jqhtml.boot()) may have children
// that were hydrated asynchronously during the 'render' event callback.
// Those children couldn't register via _find_dom_parent() because they were
// created after the parent's lifecycle started. Force DOM traversal fallback
// to reliably discover all children, including boot-hydrated ones.
if (this.args._inner_html !== undefined) {
this._use_dom_fallback = true;
}
const children = this._get_dom_children();
if (children.length === 0) {
return; // No children, nothing to wait for
@@ -2958,6 +2966,136 @@ function escape_html(str) {
return div.innerHTML;
}
/**
* JQHTML Boot - Component Hydration System
*
* Bridges server-rendered HTML and client-side jqhtml components.
*
* Server output: <div class="_Component_Init" data-component-init-name="User_Card" data-component-args='{"id":1}'></div>
* After boot(): <div class="User_Card Component">...rendered template...</div>
*
* Usage:
* await jqhtml.boot(); // Hydrate all placeholders, wait for ready
* jqhtml.boot($('#container')); // Hydrate within scope
*/
/**
* Hydrate all _Component_Init placeholders within a scope.
*
* @param scope - jQuery object, HTMLElement, or undefined (defaults to body)
* @returns Promise that resolves when all components (including nested) are ready
*/
function boot(scope) {
const jQ = typeof jQuery !== 'undefined' ? jQuery : $;
if (!scope) {
scope = jQ('body');
}
else if (!(scope instanceof jQ)) {
scope = jQ(scope);
}
const readyPromises = [];
// Find top-level placeholders only (skip those nested inside other placeholders)
scope.find('._Component_Init').each(function () {
const $element = jQ(this);
// Skip if removed from DOM
if (!document.contains($element[0])) {
return;
}
// Skip nested placeholders - they'll be hydrated by parent's render callback
let parent = $element[0].parentElement;
while (parent) {
if (parent.classList.contains('_Component_Init')) {
return;
}
parent = parent.parentElement;
}
// Hydrate this placeholder
const component = hydrateElement($element);
if (!component)
return;
// On render, recursively hydrate any nested placeholders
component.on('render', function () {
hydrateNested(component.$, jQ);
});
// Collect ready promise - parent.ready() waits for all children via _wait_for_children_ready()
readyPromises.push(component.ready());
});
// Fire jqhtml:ready event when all top-level components are ready
const result = Promise.all(readyPromises);
result.then(() => {
document.dispatchEvent(new CustomEvent('jqhtml:ready'));
});
return result;
}
/**
* Hydrate nested _Component_Init placeholders within a component's DOM.
* Called from parent's 'render' event.
*/
function hydrateNested($scope, jQ) {
$scope.find('._Component_Init').each(function () {
const $element = jQ(this);
if (!document.contains($element[0])) {
return;
}
// Skip if nested inside another placeholder
let parent = $element[0].parentElement;
while (parent && parent !== $scope[0]) {
if (parent.classList.contains('_Component_Init')) {
return;
}
parent = parent.parentElement;
}
const component = hydrateElement($element);
if (!component)
return;
// Recursively handle deeper nesting
component.on('render', function () {
hydrateNested(component.$, jQ);
});
});
}
/**
* Hydrate a single _Component_Init element into a live component.
*/
function hydrateElement($element, jQ) {
const componentName = $element.attr('data-component-init-name');
if (!componentName)
return null;
// Parse args
const argsString = $element.attr('data-component-args');
let args = {};
if (argsString) {
try {
args = JSON.parse(argsString);
}
catch (e) {
console.error(`[jqhtml.boot] Failed to parse args for ${componentName}:`, e);
}
}
// Strip data- prefix from args if present
const filteredArgs = {};
for (const [key, value] of Object.entries(args)) {
filteredArgs[key.startsWith('data-') ? key.substring(5) : key] = value;
}
// Capture innerHTML for content() and mark as boot-created
filteredArgs._inner_html = $element.html();
filteredArgs._component_name = componentName;
// Cleanup placeholder
$element.removeAttr('data-component-init-name');
$element.removeAttr('data-component-args');
$element.removeData('component-init-name');
$element.removeData('component-args');
$element.removeClass('_Component_Init');
$element.empty();
// Create component
try {
return $element.component(componentName, filteredArgs).component();
}
catch (error) {
console.error(`[jqhtml.boot] Failed to create ${componentName}:`, error);
return null;
}
}
/**
* JQHTML Debug Overlay
*
@@ -4238,7 +4376,7 @@ function init(jQuery) {
}
}
// Version - will be replaced during build with actual version from package.json
const version = '2.2.222';
const version = '2.3.4';
// Default export with all functionality
const jqhtml = {
// Core
@@ -4330,7 +4468,9 @@ const jqhtml = {
// Cache key setter - enables component caching via local storage
set_cache_key(cache_key) {
Jqhtml_Local_Storage.set_cache_key(cache_key);
}
},
// Boot - hydrate server-rendered component placeholders
boot
};
// Auto-register on window for browser environments
// This is REQUIRED for compiled templates which use window.jqhtml.register_template()
@@ -4348,5 +4488,5 @@ if (typeof window !== 'undefined' && !window.jqhtml) {
}
}
export { DebugOverlay, Jqhtml_Component, LifecycleManager as Jqhtml_LifecycleManager, Jqhtml_Local_Storage, LifecycleManager, Load_Coordinator, applyDebugDelay, create_component, jqhtml as default, devWarn, escape_html, extract_slots, get_component_class, get_component_names, get_registered_templates, get_template, get_template_by_class, handleComponentError, has_component, hideDebugOverlay, init, init_jquery_plugin, isSequentialProcessing, list_components, logDataChange, logDispatch, logInstruction, logLifecycle, process_instructions, register_component, register_template, render_template, showDebugOverlay, version };
export { DebugOverlay, Jqhtml_Component, LifecycleManager as Jqhtml_LifecycleManager, Jqhtml_Local_Storage, LifecycleManager, Load_Coordinator, applyDebugDelay, boot, create_component, jqhtml as default, devWarn, escape_html, extract_slots, get_component_class, get_component_names, get_registered_templates, get_template, get_template_by_class, handleComponentError, has_component, hideDebugOverlay, init, init_jquery_plugin, isSequentialProcessing, list_components, logDataChange, logDispatch, logInstruction, logLifecycle, process_instructions, register_component, register_template, render_template, showDebugOverlay, version };
//# sourceMappingURL=jqhtml-core.esm.js.map

File diff suppressed because one or more lines are too long

7
node_modules/@jqhtml/core/package.json generated vendored Executable file → Normal file
View File

@@ -1,6 +1,6 @@
{
"name": "@jqhtml/core",
"version": "2.2.222",
"version": "2.3.4",
"description": "Core runtime library for JQHTML",
"type": "module",
"main": "./dist/index.js",
@@ -48,11 +48,6 @@
],
"author": "JQHTML Team",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/jqhtml/jqhtml.git",
"directory": "packages/core"
},
"dependencies": {
"@rollup/plugin-node-resolve": "^16.0.1",
"@rollup/plugin-replace": "^6.0.2",

View File

@@ -1348,7 +1348,7 @@ export class CodeGenerator {
for (const [name, component] of this.components) {
code += `// Component: ${name}\n`;
code += `jqhtml_components.set('${name}', {\n`;
code += ` _jqhtml_version: '2.2.222',\n`; // Version will be replaced during build
code += ` _jqhtml_version: '2.3.4',\n`; // Version will be replaced during build
code += ` name: '${name}',\n`;
code += ` tag: '${component.tagName}',\n`;
code += ` defaultAttributes: ${this.serializeAttributeObject(component.defaultAttributes)},\n`;

7
node_modules/@jqhtml/parser/package.json generated vendored Executable file → Normal file
View File

@@ -1,6 +1,6 @@
{
"name": "@jqhtml/parser",
"version": "2.2.222",
"version": "2.3.4",
"description": "JQHTML template parser - converts templates to JavaScript",
"type": "module",
"main": "dist/index.js",
@@ -40,11 +40,6 @@
],
"author": "JQHTML Team",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/jqhtml/jqhtml.git",
"directory": "packages/parser"
},
"dependencies": {
"@types/jest": "^29.5.11",
"@types/jquery": "^3.5.32",

View File

@@ -1 +1 @@
2.2.222
2.3.4

View File

@@ -0,0 +1,109 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BladeComponentSemanticTokensProvider = void 0;
const vscode = __importStar(require("vscode"));
/**
* Provides semantic tokens for uppercase component tags in Blade files
*
* This provider highlights:
* - Component tag names in cyan/turquoise (using 'class' token type)
* - The tag="" attribute on jqhtml components in orange (using 'jqhtmlTagAttribute' token type)
*
* Usage:
* Register with vscode.languages.registerDocumentSemanticTokensProvider()
* using SemanticTokensLegend(['class', 'jqhtmlTagAttribute'])
*/
class BladeComponentSemanticTokensProvider {
provideDocumentSemanticTokens(document) {
return __awaiter(this, void 0, void 0, function* () {
const tokens_builder = new vscode.SemanticTokensBuilder();
// Only process Blade files
if (document.languageId !== 'blade') {
return tokens_builder.build();
}
const text = document.getText();
// Match opening tags that start with uppercase letter to find jqhtml components
// Matches: <ComponentName ...>, captures the entire tag up to >
const component_tag_regex = /<([A-Z][a-zA-Z0-9_]*)([^>]*?)>/g;
let component_match;
while ((component_match = component_tag_regex.exec(text)) !== null) {
const tag_name = component_match[1];
const tag_attributes = component_match[2];
const tag_start = component_match.index + component_match[0].indexOf(tag_name);
const tag_position = document.positionAt(tag_start);
// Push token for the component tag name
// Token type 0 maps to 'class' which VS Code themes style as entity.name.class (turquoise/cyan)
tokens_builder.push(tag_position.line, tag_position.character, tag_name.length, 0, 0);
// Now look for tag="" attribute within this component's attributes
// Matches: tag="..." or tag='...'
const tag_attr_regex = /\btag\s*=/g;
let attr_match;
while ((attr_match = tag_attr_regex.exec(tag_attributes)) !== null) {
// Calculate the position of 'tag' within the document
const attr_start = component_match.index + component_match[0].indexOf(tag_attributes) + attr_match.index;
const attr_position = document.positionAt(attr_start);
// Push token for 'tag' attribute name
// Token type 1 maps to 'jqhtmlTagAttribute' which we'll define to be orange
tokens_builder.push(attr_position.line, attr_position.character, 3, 1, 0);
}
}
// Also match closing tags that start with uppercase letter
// Matches: </ComponentName>
const closing_tag_regex = /<\/([A-Z][a-zA-Z0-9_]*)/g;
let closing_match;
while ((closing_match = closing_tag_regex.exec(text)) !== null) {
const tag_name = closing_match[1];
const tag_start = closing_match.index + closing_match[0].indexOf(tag_name);
const position = document.positionAt(tag_start);
// Push token for the tag name
// Token type 0 maps to 'class' which VS Code themes style as entity.name.class (turquoise/cyan)
tokens_builder.push(position.line, position.character, tag_name.length, 0, 0);
}
return tokens_builder.build();
});
}
}
exports.BladeComponentSemanticTokensProvider = BladeComponentSemanticTokensProvider;
//# sourceMappingURL=blade_component_provider.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"blade_component_provider.js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v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.init_blade_language_config = void 0;
const vscode = __importStar(require("vscode"));
/**
* Initialize Blade language configuration
*
* Sets up:
* - Indentation rules for Blade templates
* - Auto-indent behavior when pressing Enter between tags
* - Word pattern for Blade files
*
* Call this once during extension activation.
*/
const init_blade_language_config = () => {
// HTML empty elements that don't require closing tags
const EMPTY_ELEMENTS = [
@@ -48,19 +68,23 @@ const init_blade_language_config = () => {
// Configure Blade language indentation and auto-closing behavior
vscode.languages.setLanguageConfiguration('blade', {
indentationRules: {
// Increase indent after opening tag (except void elements and self-closing)
increaseIndentPattern: /<(?!\?|(?:area|base|br|col|frame|hr|html|img|input|link|meta|param)\b|[^>]*\/>)([-_\.A-Za-z0-9]+)(?=\s|>)\b[^>]*>(?!.*<\/\1>)|<!--(?!.*-->)|\{[^}"']*$/,
// Decrease indent on closing tag
decreaseIndentPattern: /^\s*(<\/(?!html)[-_\.A-Za-z0-9]+\b[^>]*>|-->|\})/,
},
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,
onEnterRules: [
{
// When pressing Enter between opening and closing tags, auto-indent
// e.g., <div>|</div> -> <div>\n |\n</div>
beforeText: new RegExp(`<(?!(?:${EMPTY_ELEMENTS.join('|')}))([_:\\w][_:\\w-.\\d]*)([^/>]*(?!/)>)[^<]*$`, 'i'),
afterText: /^<\/([_:\w][_:\w-.\d]*)\s*>$/i,
action: { indentAction: vscode.IndentAction.IndentOutdent },
},
{
// When pressing Enter after opening tag, auto-indent
// e.g., <div>| -> <div>\n |
beforeText: new RegExp(`<(?!(?:${EMPTY_ELEMENTS.join('|')}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`, 'i'),
action: { indentAction: vscode.IndentAction.Indent },
},
@@ -68,4 +92,4 @@ const init_blade_language_config = () => {
});
};
exports.init_blade_language_config = init_blade_language_config;
//# sourceMappingURL=blade_client.js.map
//# sourceMappingURL=blade_language_config.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"blade_language_config.js","sourceRoot":"","sources":["../src/blade_language_config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAEjC;;;;;;;;;GASG;AACI,MAAM,0BAA0B,GAAG,GAAG,EAAE;IAC3C,sDAAsD;IACtD,MAAM,cAAc,GAAa;QAC7B,MAAM;QACN,MAAM;QACN,IAAI;QACJ,KAAK;QACL,OAAO;QACP,IAAI;QACJ,KAAK;QACL,OAAO;QACP,QAAQ;QACR,MAAM;QACN,UAAU;QACV,MAAM;QACN,OAAO;QACP,QAAQ;QACR,OAAO;QACP,KAAK;KACR,CAAC;IAEF,iEAAiE;IACjE,MAAM,CAAC,SAAS,CAAC,wBAAwB,CAAC,OAAO,EAAE;QAC/C,gBAAgB,EAAE;YACd,4EAA4E;YAC5E,qBAAqB,EACjB,wJAAwJ;YAC5J,iCAAiC;YACjC,qBAAqB,EACjB,kDAAkD;SACzD;QACD,WAAW,EACP,gFAAgF;QACpF,YAAY,EAAE;YACV;gBACI,oEAAoE;gBACpE,2CAA2C;gBAC3C,UAAU,EAAE,IAAI,MAAM,CAClB,UAAU,cAAc,CAAC,IAAI,CACzB,GAAG,CACN,8CAA8C,EAC/C,GAAG,CACN;gBACD,SAAS,EAAE,+BAA+B;gBAC1C,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC,aAAa,EAAE;aAC9D;YACD;gBACI,qDAAqD;gBACrD,6BAA6B;gBAC7B,UAAU,EAAE,IAAI,MAAM,CAClB,UAAU,cAAc,CAAC,IAAI,CACzB,GAAG,CACN,sCAAsC,EACvC,GAAG,CACN;gBACD,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE;aACvD;SACJ;KACJ,CAAC,CAAC;AACP,CAAC,CAAC;AA3DW,QAAA,0BAA0B,8BA2DrC"}

View File

@@ -15,17 +15,47 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.blade_spacer = void 0;
const vscode = __importStar(require("vscode"));
const config_1 = require("./config");
/**
* Blade Auto-Spacing Provider
*
* Automatically adds spaces inside Blade tags when typing:
* {{ -> {{ | }} (cursor at |)
* {!! -> {!! | !!}
* {{-- -> {{-- | --}}
*
* Configuration:
* Set 'jqhtml.enableBladeAutoSpacing' to false to disable
* (or modify the config key below to match your extension's namespace)
*/
const TAG_DOUBLE = 0;
const TAG_UNESCAPED = 1;
const TAG_COMMENT = 2;
@@ -62,9 +92,17 @@ const chars_for_change = (doc, change) => {
const end = translate(change.range.start, -1);
return doc.getText(new vscode.Range(start, end)) === ' ' ? 4 : 3;
};
const blade_spacer = async (e, editor) => {
const config = (0, config_1.get_config)();
if (!config.get('enableBladeAutoSpacing', true) ||
/**
* Main entry point - call this from onDidChangeTextDocument
*
* @param e - The text document change event
* @param editor - The active text editor (optional)
* @param config_enabled - Whether auto-spacing is enabled (default: true)
* Pass your own config check here, e.g.:
* vscode.workspace.getConfiguration('jqhtml').get('enableBladeAutoSpacing', true)
*/
const blade_spacer = (e_1, editor_1, ...args_1) => __awaiter(void 0, [e_1, editor_1, ...args_1], void 0, function* (e, editor, config_enabled = true) {
if (!config_enabled ||
!editor ||
editor.document.fileName.indexOf('.blade.php') === -1) {
return;
@@ -109,6 +147,6 @@ const blade_spacer = async (e, editor) => {
if (ranges.length > 0 && snippets[tag_type]) {
editor.insertSnippet(new vscode.SnippetString(snippets[tag_type]), ranges);
}
};
});
exports.blade_spacer = blade_spacer;
//# sourceMappingURL=blade_spacer.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"blade_spacer.js","sourceRoot":"","sources":["../src/blade_spacer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAEjC;;;;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C,MAAM,CAAC,aAAa,CAAC,IAAI,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAC/E,CAAC;AACL,CAAC,CAAA,CAAC;AArEW,QAAA,YAAY,gBAqEvB"}

View File

@@ -39,6 +39,9 @@ const vscode = __importStar(require("vscode"));
const formatter_1 = require("./formatter");
const componentIndex_1 = require("./componentIndex");
const definitionProvider_1 = require("./definitionProvider");
const blade_component_provider_1 = require("./blade_component_provider");
const blade_spacer_1 = require("./blade_spacer");
const blade_language_config_1 = require("./blade_language_config");
function activate(context) {
console.log('JQHTML extension activated');
// Initialize component index
@@ -133,6 +136,32 @@ function activate(context) {
if (config.get('formatOnSave')) {
console.log('JQHTML: Format on save is enabled');
}
// =========================================================================
// BLADE SUPPORT (Optional - controlled by jqhtml.enableBladeSupport setting)
// =========================================================================
const jqhtmlConfig = vscode.workspace.getConfiguration('jqhtml');
const bladeSupport = jqhtmlConfig.get('enableBladeSupport', true);
if (bladeSupport) {
// Register Blade component semantic tokens provider
// Highlights component tag names and tag="" attributes in .blade.php files
const bladeComponentProvider = new blade_component_provider_1.BladeComponentSemanticTokensProvider();
context.subscriptions.push(vscode.languages.registerDocumentSemanticTokensProvider([{ language: 'blade' }, { pattern: '**/*.blade.php' }], bladeComponentProvider, new vscode.SemanticTokensLegend(['class', 'jqhtmlTagAttribute'])));
console.log('JQHTML: Blade component highlighting registered');
// Register Blade auto-spacing ({{ -> {{ | }})
const getAutoSpacingEnabled = () => {
return vscode.workspace.getConfiguration('jqhtml').get('enableBladeAutoSpacing', true);
};
context.subscriptions.push(vscode.workspace.onDidChangeTextDocument((event) => {
(0, blade_spacer_1.blade_spacer)(event, vscode.window.activeTextEditor, getAutoSpacingEnabled());
}));
console.log('JQHTML: Blade auto-spacing registered');
// Initialize Blade language configuration (indentation rules)
(0, blade_language_config_1.init_blade_language_config)();
console.log('JQHTML: Blade language configuration initialized');
}
else {
console.log('JQHTML: Blade support disabled via settings');
}
console.log('JQHTML: All features registered (formatter, auto-close, goto definition, hover)');
// Return public API for other extensions
return {

File diff suppressed because one or more lines are too long

51
node_modules/@jqhtml/vscode-extension/package.json generated vendored Executable file → Normal file
View File

@@ -2,7 +2,7 @@
"name": "@jqhtml/vscode-extension",
"displayName": "JQHTML",
"description": "Syntax highlighting and language support for JQHTML template files",
"version": "2.2.222",
"version": "2.3.4",
"publisher": "jqhtml",
"license": "MIT",
"publishConfig": {
@@ -22,6 +22,7 @@
"snippets",
"images",
"language-configuration.json",
"blade-language-configuration.json",
".version",
"README.md",
"LLM_REFERENCE.md",
@@ -68,6 +69,10 @@
"light": "./images/jqhtml-icon.svg",
"dark": "./images/jqhtml-icon.svg"
}
},
{
"id": "blade",
"configuration": "./blade-language-configuration.json"
}
],
"grammars": [
@@ -75,6 +80,14 @@
"language": "jqhtml",
"scopeName": "source.jqhtml",
"path": "./syntaxes/jqhtml.tmLanguage.json"
},
{
"scopeName": "source.jqhtml.blade-injection",
"path": "./syntaxes/blade-jqhtml.tmLanguage.json",
"injectTo": [
"text.blade",
"text.html.php"
]
}
],
"snippets": [
@@ -93,6 +106,42 @@
},
"editor.bracketPairColorization.enabled": false,
"editor.guides.bracketPairs": false
},
"editor.semanticTokenColorCustomizations": {
"rules": {
"jqhtmlTagAttribute": "#FFA500"
}
}
},
"semanticTokenTypes": [
{
"id": "jqhtmlTagAttribute",
"superType": "parameter",
"description": "The tag attribute on jqhtml components"
}
],
"semanticTokenScopes": [
{
"scopes": {
"jqhtmlTagAttribute": [
"entity.other.attribute-name.jqhtml.tag"
]
}
}
],
"configuration": {
"title": "JQHTML",
"properties": {
"jqhtml.enableBladeSupport": {
"type": "boolean",
"default": true,
"description": "Enable JQHTML component highlighting in Laravel Blade (.blade.php) files"
},
"jqhtml.enableBladeAutoSpacing": {
"type": "boolean",
"default": true,
"description": "Automatically add spaces inside Blade tags when typing ({{ -> {{ | }})"
}
}
}
},

View File

@@ -1,6 +1,6 @@
{
"name": "Blade JQHTML Components",
"scopeName": "source.jqhtml.injection",
"scopeName": "source.jqhtml.blade-injection",
"injectionSelector": "L:text.blade, L:text.html.php",
"patterns": [
{

4
node_modules/@jqhtml/webpack-loader/package.json generated vendored Executable file → Normal file
View File

@@ -1,6 +1,6 @@
{
"name": "@jqhtml/webpack-loader",
"version": "2.2.222",
"version": "2.3.4",
"description": "Webpack loader for JQHTML templates",
"type": "module",
"main": "dist/index.js",
@@ -30,7 +30,7 @@
"template"
],
"dependencies": {
"@jqhtml/parser": "2.2.222",
"@jqhtml/parser": "2.3.4",
"@types/loader-utils": "^2.0.6",
"@types/node": "^20.0.0",
"@types/webpack": "^5.28.5",

0
node_modules/caniuse-lite/LICENSE generated vendored Executable file → Normal file
View File

0
node_modules/caniuse-lite/README.md generated vendored Executable file → Normal file
View File

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
module.exports={A:{A:{"2":"K D E F A B wC"},B:{"1":"UB VB WB XB YB I","2":"0 1 2 3 4 5 C L M G N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB"},C:{"2":"0 1 2 3 4 5 6 7 8 9 xC TC J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC yC zC 0C 1C 2C"},D:{"1":"UB VB WB XB YB I XC MC YC","2":"0 1 2 3 4 5 6 7 8 9 J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB"},E:{"2":"J ZB K D E F A B C L M G 3C ZC 4C 5C 6C 7C aC NC OC 8C 9C AD bC cC PC BD QC dC eC fC gC hC CD RC iC jC kC lC mC DD SC nC oC pC qC rC sC tC ED FD"},F:{"1":"4 5","2":"0 1 2 3 6 7 8 9 F B C G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GD HD ID JD NC uC KD OC"},G:{"2":"E ZC LD vC MD ND OD PD QD RD SD TD UD VD WD XD YD ZD aD bD cD dD eD bC cC PC fD QC dC eC fC gC hC gD RC iC jC kC lC mC hD SC nC oC pC qC rC sC tC"},H:{"2":"iD"},I:{"1":"I","2":"TC J jD kD lD mD vC nD oD"},J:{"2":"D A"},K:{"2":"A B C H NC uC OC"},L:{"1":"I"},M:{"2":"MC"},N:{"2":"A B"},O:{"2":"PC"},P:{"2":"6 7 8 9 J AB BB CB DB EB FB pD qD rD sD tD aC uD vD wD xD yD QC RC SC zD"},Q:{"2":"0D"},R:{"2":"1D"},S:{"2":"2D 3D"}},B:5,C:"CSS if() function",D:true};
module.exports={A:{A:{"2":"K D E F A B wC"},B:{"1":"UB VB WB XB YB I","2":"0 1 2 3 4 5 C L M G N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB"},C:{"2":"0 1 2 3 4 5 6 7 8 9 xC TC J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC yC zC 0C 1C 2C"},D:{"1":"UB VB WB XB YB I XC MC YC","2":"0 1 2 3 4 5 6 7 8 9 J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB"},E:{"2":"J ZB K D E F A B C L M G 3C ZC 4C 5C 6C 7C aC NC OC 8C 9C AD bC cC PC BD QC dC eC fC gC hC CD RC iC jC kC lC mC DD SC nC oC pC qC rC sC tC ED FD"},F:{"1":"4","2":"0 1 2 3 5 6 7 8 9 F B C G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GD HD ID JD NC uC KD OC"},G:{"2":"E ZC LD vC MD ND OD PD QD RD SD TD UD VD WD XD YD ZD aD bD cD dD eD bC cC PC fD QC dC eC fC gC hC gD RC iC jC kC lC mC hD SC nC oC pC qC rC sC tC"},H:{"2":"iD"},I:{"1":"I","2":"TC J jD kD lD mD vC nD oD"},J:{"2":"D A"},K:{"2":"A B C H NC uC OC"},L:{"1":"I"},M:{"2":"MC"},N:{"2":"A B"},O:{"2":"PC"},P:{"2":"6 7 8 9 J AB BB CB DB EB FB pD qD rD sD tD aC uD vD wD xD yD QC RC SC zD"},Q:{"2":"0D"},R:{"2":"1D"},S:{"2":"2D 3D"}},B:5,C:"CSS if() function",D:true};

2
node_modules/caniuse-lite/package.json generated vendored Executable file → Normal file
View File

@@ -1,6 +1,6 @@
{
"name": "caniuse-lite",
"version": "1.0.30001756",
"version": "1.0.30001757",
"description": "A smaller version of caniuse-db, with only the essentials!",
"main": "dist/unpacker/index.js",
"files": [

0
node_modules/electron-to-chromium/LICENSE generated vendored Executable file → Normal file
View File

0
node_modules/electron-to-chromium/README.md generated vendored Executable file → Normal file
View File

0
node_modules/electron-to-chromium/chromium-versions.js generated vendored Executable file → Normal file
View File

0
node_modules/electron-to-chromium/chromium-versions.json generated vendored Executable file → Normal file
View File

3
node_modules/electron-to-chromium/full-chromium-versions.js generated vendored Executable file → Normal file
View File

@@ -2610,6 +2610,7 @@ module.exports = {
"144.0.7526.0": [
"40.0.0-alpha.5",
"40.0.0-alpha.6",
"40.0.0-alpha.7"
"40.0.0-alpha.7",
"40.0.0-alpha.8"
]
};

2
node_modules/electron-to-chromium/full-chromium-versions.json generated vendored Executable file → Normal file

File diff suppressed because one or more lines are too long

3
node_modules/electron-to-chromium/full-versions.js generated vendored Executable file → Normal file
View File

@@ -1671,5 +1671,6 @@ module.exports = {
"40.0.0-alpha.4": "144.0.7506.0",
"40.0.0-alpha.5": "144.0.7526.0",
"40.0.0-alpha.6": "144.0.7526.0",
"40.0.0-alpha.7": "144.0.7526.0"
"40.0.0-alpha.7": "144.0.7526.0",
"40.0.0-alpha.8": "144.0.7526.0"
};

2
node_modules/electron-to-chromium/full-versions.json generated vendored Executable file → Normal file

File diff suppressed because one or more lines are too long

0
node_modules/electron-to-chromium/index.js generated vendored Executable file → Normal file
View File

2
node_modules/electron-to-chromium/package.json generated vendored Executable file → Normal file
View File

@@ -1,6 +1,6 @@
{
"name": "electron-to-chromium",
"version": "1.5.259",
"version": "1.5.260",
"description": "Provides a list of electron-to-chromium version mappings",
"main": "index.js",
"files": [

0
node_modules/electron-to-chromium/versions.js generated vendored Executable file → Normal file
View File

0
node_modules/electron-to-chromium/versions.json generated vendored Executable file → Normal file
View File

38
package-lock.json generated
View File

@@ -2658,9 +2658,9 @@
}
},
"node_modules/@jqhtml/core": {
"version": "2.2.222",
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/core/-/core-2.2.222.tgz",
"integrity": "sha512-cO5iO9VjHqeOZhdz+WD0rCb+mvS2U6eHMWRrkrTS4F3RmYrUOPk+8KUpeWUXkND4D+JnK9iMmLWY1+WjQHDVFQ==",
"version": "2.3.4",
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/core/-/core-2.3.4.tgz",
"integrity": "sha512-RQLviu8NcIxrnd1cUOE8HNPmwWT/kVliwHl91zqYaYw3cXstF2PG9OxbRtiUWAdbOxuqJSLkELrXLG+4cr1o9w==",
"license": "MIT",
"dependencies": {
"@rollup/plugin-node-resolve": "^16.0.1",
@@ -2684,9 +2684,9 @@
}
},
"node_modules/@jqhtml/parser": {
"version": "2.2.222",
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/parser/-/parser-2.2.222.tgz",
"integrity": "sha512-jEF+HfOMRwkZ9lVWO7+wKMKDXsI51R5g0qq2trqTXAOs2aNnDtrJV9yqY1LWXMdi1h2iV5AJhbkvAZS1p9gzSw==",
"version": "2.3.4",
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/parser/-/parser-2.3.4.tgz",
"integrity": "sha512-jFc7RtmxMdt8ewJmuq6lw74c3dMHqaZ9BXUX3czwtU4w1ZxkLkppEhTmrm+wtQ7/rdK6jsfvL4W++wrXQtoclA==",
"license": "MIT",
"dependencies": {
"@types/jest": "^29.5.11",
@@ -2724,21 +2724,21 @@
}
},
"node_modules/@jqhtml/vscode-extension": {
"version": "2.2.222",
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/vscode-extension/-/vscode-extension-2.2.222.tgz",
"integrity": "sha512-o5WAF3JMgMjORImpCvS5yCSnduS1iQJOjzNDjHMzFglZIB1lfyzq9VV7n3ykQVLmRUBB3p1tyPUe6R08b+7Txw==",
"version": "2.3.4",
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/vscode-extension/-/vscode-extension-2.3.4.tgz",
"integrity": "sha512-AU3M2yD4tiGKcfkW2cBtO26yKzdJj5+Af1BBoblnr1zqPzlTyLaZapoLPL/bEpSwnaFB5I3XqKuBj2sKSDE30Q==",
"license": "MIT",
"engines": {
"vscode": "^1.74.0"
}
},
"node_modules/@jqhtml/webpack-loader": {
"version": "2.2.222",
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/webpack-loader/-/webpack-loader-2.2.222.tgz",
"integrity": "sha512-6ucNvup5MJ9w6UCjL6nvKKRHfrCipqC0qLApxeTToQROY/16vZ/YbLj4ZgzsrUfu656bSYlcWG/OBrUfxUZnog==",
"version": "2.3.4",
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/webpack-loader/-/webpack-loader-2.3.4.tgz",
"integrity": "sha512-QYanMVtRQ6Y5Xuw/AfZFdbSwMWnLBKo53/mpQtOEqdY1+cMCcbt/C3oxz8fJaCzAXWmxOZVqxU7kNxZ1YihRtQ==",
"license": "MIT",
"dependencies": {
"@jqhtml/parser": "2.2.222",
"@jqhtml/parser": "2.3.4",
"@types/loader-utils": "^2.0.6",
"@types/node": "^20.0.0",
"@types/webpack": "^5.28.5",
@@ -5355,9 +5355,9 @@
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001756",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001756.tgz",
"integrity": "sha512-4HnCNKbMLkLdhJz3TToeVWHSnfJvPaq6vu/eRP0Ahub/07n484XHhBF5AJoSGHdVrS8tKFauUQz8Bp9P7LVx7A==",
"version": "1.0.30001757",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001757.tgz",
"integrity": "sha512-r0nnL/I28Zi/yjk1el6ilj27tKcdjLsNqAOZr0yVjWPrSQyHgKI2INaEWw21bAQSv2LXRt1XuCS/GomNpWOxsQ==",
"funding": [
{
"type": "opencollective",
@@ -6617,9 +6617,9 @@
"license": "MIT"
},
"node_modules/electron-to-chromium": {
"version": "1.5.259",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.259.tgz",
"integrity": "sha512-I+oLXgpEJzD6Cwuwt1gYjxsDmu/S/Kd41mmLA3O+/uH2pFRO/DvOjUyGozL8j3KeLV6WyZ7ssPwELMsXCcsJAQ==",
"version": "1.5.260",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.260.tgz",
"integrity": "sha512-ov8rBoOBhVawpzdre+Cmz4FB+y66Eqrk6Gwqd8NGxuhv99GQ8XqMAr351KEkOt7gukXWDg6gJWEMKgL2RLMPtA==",
"license": "ISC"
},
"node_modules/elliptic": {