Implement JQHTML function cache ID system and fix bundle compilation Implement underscore prefix for system tables Fix JS syntax linter to support decorators and grant exception to Task system SPA: Update planning docs and wishlists with remaining features SPA: Document Navigation API abandonment and future enhancements Implement SPA browser integration with History API (Phase 1) Convert contacts view page to SPA action Convert clients pages to SPA actions and document conversion procedure SPA: Merge GET parameters and update documentation Implement SPA route URL generation in JavaScript and PHP Implement SPA bootstrap controller architecture Add SPA routing manual page (rsx:man spa) Add SPA routing documentation to CLAUDE.md Phase 4 Complete: Client-side SPA routing implementation Update get_routes() consumers for unified route structure Complete SPA Phase 3: PHP-side route type detection and is_spa flag Restore unified routes structure and Manifest_Query class Refactor route indexing and add SPA infrastructure Phase 3 Complete: SPA route registration in manifest Implement SPA Phase 2: Extract router code and test decorators Rename Jqhtml_Component to Component and complete SPA foundation setup 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
114 lines
4.2 KiB
JavaScript
Executable File
114 lines
4.2 KiB
JavaScript
Executable File
"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.blade_spacer = void 0;
|
|
const vscode = __importStar(require("vscode"));
|
|
const config_1 = require("./config");
|
|
const TAG_DOUBLE = 0;
|
|
const TAG_UNESCAPED = 1;
|
|
const TAG_COMMENT = 2;
|
|
const snippets = {
|
|
[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, offset) => {
|
|
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, change) => {
|
|
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;
|
|
};
|
|
const blade_spacer = async (e, editor) => {
|
|
const config = (0, config_1.get_config)();
|
|
if (!config.get('enableBladeAutoSpacing', true) ||
|
|
!editor ||
|
|
editor.document.fileName.indexOf('.blade.php') === -1) {
|
|
return;
|
|
}
|
|
let tag_type = -1;
|
|
let ranges = [];
|
|
let offsets = [];
|
|
// 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);
|
|
}
|
|
};
|
|
exports.blade_spacer = blade_spacer;
|
|
//# sourceMappingURL=blade_spacer.js.map
|