@lark.js/mvc 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -25
- package/dist/{chunk-5OEHRF3U.js → chunk-Y72BUONO.js} +8 -9
- package/dist/index.cjs +165 -54
- package/dist/index.d.cts +79 -19
- package/dist/index.d.ts +79 -19
- package/dist/index.js +163 -51
- package/dist/vite.cjs +8 -9
- package/dist/vite.d.cts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +1 -1
- package/dist/webpack.cjs +8 -9
- package/dist/webpack.js +1 -1
- package/package.json +9 -6
- package/lark.d.ts +0 -1176
package/dist/vite.cjs
CHANGED
|
@@ -14654,17 +14654,17 @@ function restoreComments(source, comments) {
|
|
|
14654
14654
|
}
|
|
14655
14655
|
function processViewEvents(source) {
|
|
14656
14656
|
return source.replace(
|
|
14657
|
-
|
|
14657
|
+
/@(\w+)="([^"]+)"/g,
|
|
14658
14658
|
(fullAttr, eventName, attrValue) => {
|
|
14659
14659
|
const eventMatch = attrValue.match(/^(\w+)\((.*)\)$/s);
|
|
14660
14660
|
if (!eventMatch) return fullAttr;
|
|
14661
14661
|
const handlerName = eventMatch[1];
|
|
14662
14662
|
const paramsStr = eventMatch[2].trim();
|
|
14663
14663
|
if (!paramsStr) {
|
|
14664
|
-
return
|
|
14664
|
+
return `@${eventName}="${VIEW_ID_PLACEHOLDER}${SPLITTER}${handlerName}()"`;
|
|
14665
14665
|
}
|
|
14666
14666
|
const urlParams = jsObjectToUrlParams(paramsStr);
|
|
14667
|
-
return
|
|
14667
|
+
return `@${eventName}="${VIEW_ID_PLACEHOLDER}${SPLITTER}${handlerName}(${urlParams})"`;
|
|
14668
14668
|
}
|
|
14669
14669
|
);
|
|
14670
14670
|
}
|
|
@@ -14890,12 +14890,12 @@ function convertArtExpression(code, debug, lineNo, blockStack = []) {
|
|
|
14890
14890
|
const last = blockStack.pop();
|
|
14891
14891
|
if (!last) {
|
|
14892
14892
|
throw new Error(
|
|
14893
|
-
`[@lark/mvc error
|
|
14893
|
+
`[@lark/mvc error] unexpected {{${code}}}: no matching open block`
|
|
14894
14894
|
);
|
|
14895
14895
|
}
|
|
14896
14896
|
if (last.ctrl !== expectedCtrl) {
|
|
14897
14897
|
throw new Error(
|
|
14898
|
-
`[@lark/mvc error
|
|
14898
|
+
`[@lark/mvc error] unexpected {{${code}}}: expected {{/${last.ctrl}}} to close block opened at line ${last.line}`
|
|
14899
14899
|
);
|
|
14900
14900
|
}
|
|
14901
14901
|
return `${debugPrefix}<%}%>`;
|
|
@@ -15255,19 +15255,18 @@ var BUILTIN_GLOBALS = {
|
|
|
15255
15255
|
// Reference lookup: (refData, value) => key
|
|
15256
15256
|
// Finds or allocates a SPLITTER-prefixed key in refData for a given
|
|
15257
15257
|
// object reference. Used by {{@ref}} operator for passing object
|
|
15258
|
-
// references to child views via lark
|
|
15259
|
-
// Aligned with mx.js Updater_Ref.
|
|
15258
|
+
// references to child views via v-lark attributes.
|
|
15260
15259
|
$i: 1,
|
|
15261
15260
|
// URI encoder: v => encodeURIComponent($n(v)).replace(/[!')(*]/g, extraMap)
|
|
15262
15261
|
// Extends encodeURIComponent with encoding of ! ' ( ) *.
|
|
15263
|
-
// Applied to values in
|
|
15262
|
+
// Applied to values in @event URL parameters and {{!uri}} contexts.
|
|
15264
15263
|
$eu: 1,
|
|
15265
15264
|
// Quote encoder: v => $n(v).replace(/['"\\]/g, '\\$&')
|
|
15266
15265
|
// Escapes quotes and backslashes for safe embedding in HTML attribute
|
|
15267
15266
|
// values (e.g. data-json='...').
|
|
15268
15267
|
$eq: 1,
|
|
15269
15268
|
// View ID — the unique identifier of the owning View instance.
|
|
15270
|
-
// Injected into
|
|
15269
|
+
// Injected into @event attribute values at render time so that
|
|
15271
15270
|
// EventDelegator can dispatch events to the correct View handler.
|
|
15272
15271
|
// The \x1f placeholder in compiled output is replaced with '+$viewId+'.
|
|
15273
15272
|
$viewId: 1,
|
package/dist/vite.d.cts
CHANGED
|
@@ -8,7 +8,7 @@ import { Plugin } from 'vite';
|
|
|
8
8
|
*
|
|
9
9
|
* 0 configuration — just add the plugin and it works.
|
|
10
10
|
* - All template operators: = (escape), ! (raw), @ (ref lookup), : (binding)
|
|
11
|
-
* -
|
|
11
|
+
* - @event attribute processing with $g prefix
|
|
12
12
|
* - $eu (URI encoding), $eq (quote encoding), $i (reference lookup)
|
|
13
13
|
* - Debug mode with line tracking
|
|
14
14
|
* - View ID injection
|
package/dist/vite.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { Plugin } from 'vite';
|
|
|
8
8
|
*
|
|
9
9
|
* 0 configuration — just add the plugin and it works.
|
|
10
10
|
* - All template operators: = (escape), ! (raw), @ (ref lookup), : (binding)
|
|
11
|
-
* -
|
|
11
|
+
* - @event attribute processing with $g prefix
|
|
12
12
|
* - $eu (URI encoding), $eq (quote encoding), $i (reference lookup)
|
|
13
13
|
* - Debug mode with line tracking
|
|
14
14
|
* - View ID injection
|
package/dist/vite.js
CHANGED
package/dist/webpack.cjs
CHANGED
|
@@ -14652,17 +14652,17 @@ function restoreComments(source, comments) {
|
|
|
14652
14652
|
}
|
|
14653
14653
|
function processViewEvents(source) {
|
|
14654
14654
|
return source.replace(
|
|
14655
|
-
|
|
14655
|
+
/@(\w+)="([^"]+)"/g,
|
|
14656
14656
|
(fullAttr, eventName, attrValue) => {
|
|
14657
14657
|
const eventMatch = attrValue.match(/^(\w+)\((.*)\)$/s);
|
|
14658
14658
|
if (!eventMatch) return fullAttr;
|
|
14659
14659
|
const handlerName = eventMatch[1];
|
|
14660
14660
|
const paramsStr = eventMatch[2].trim();
|
|
14661
14661
|
if (!paramsStr) {
|
|
14662
|
-
return
|
|
14662
|
+
return `@${eventName}="${VIEW_ID_PLACEHOLDER}${SPLITTER}${handlerName}()"`;
|
|
14663
14663
|
}
|
|
14664
14664
|
const urlParams = jsObjectToUrlParams(paramsStr);
|
|
14665
|
-
return
|
|
14665
|
+
return `@${eventName}="${VIEW_ID_PLACEHOLDER}${SPLITTER}${handlerName}(${urlParams})"`;
|
|
14666
14666
|
}
|
|
14667
14667
|
);
|
|
14668
14668
|
}
|
|
@@ -14888,12 +14888,12 @@ function convertArtExpression(code, debug, lineNo, blockStack = []) {
|
|
|
14888
14888
|
const last = blockStack.pop();
|
|
14889
14889
|
if (!last) {
|
|
14890
14890
|
throw new Error(
|
|
14891
|
-
`[@lark/mvc error
|
|
14891
|
+
`[@lark/mvc error] unexpected {{${code}}}: no matching open block`
|
|
14892
14892
|
);
|
|
14893
14893
|
}
|
|
14894
14894
|
if (last.ctrl !== expectedCtrl) {
|
|
14895
14895
|
throw new Error(
|
|
14896
|
-
`[@lark/mvc error
|
|
14896
|
+
`[@lark/mvc error] unexpected {{${code}}}: expected {{/${last.ctrl}}} to close block opened at line ${last.line}`
|
|
14897
14897
|
);
|
|
14898
14898
|
}
|
|
14899
14899
|
return `${debugPrefix}<%}%>`;
|
|
@@ -15253,19 +15253,18 @@ var BUILTIN_GLOBALS = {
|
|
|
15253
15253
|
// Reference lookup: (refData, value) => key
|
|
15254
15254
|
// Finds or allocates a SPLITTER-prefixed key in refData for a given
|
|
15255
15255
|
// object reference. Used by {{@ref}} operator for passing object
|
|
15256
|
-
// references to child views via lark
|
|
15257
|
-
// Aligned with mx.js Updater_Ref.
|
|
15256
|
+
// references to child views via v-lark attributes.
|
|
15258
15257
|
$i: 1,
|
|
15259
15258
|
// URI encoder: v => encodeURIComponent($n(v)).replace(/[!')(*]/g, extraMap)
|
|
15260
15259
|
// Extends encodeURIComponent with encoding of ! ' ( ) *.
|
|
15261
|
-
// Applied to values in
|
|
15260
|
+
// Applied to values in @event URL parameters and {{!uri}} contexts.
|
|
15262
15261
|
$eu: 1,
|
|
15263
15262
|
// Quote encoder: v => $n(v).replace(/['"\\]/g, '\\$&')
|
|
15264
15263
|
// Escapes quotes and backslashes for safe embedding in HTML attribute
|
|
15265
15264
|
// values (e.g. data-json='...').
|
|
15266
15265
|
$eq: 1,
|
|
15267
15266
|
// View ID — the unique identifier of the owning View instance.
|
|
15268
|
-
// Injected into
|
|
15267
|
+
// Injected into @event attribute values at render time so that
|
|
15269
15268
|
// EventDelegator can dispatch events to the correct View handler.
|
|
15270
15269
|
// The \x1f placeholder in compiled output is replaced with '+$viewId+'.
|
|
15271
15270
|
$viewId: 1,
|
package/dist/webpack.js
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark.js/mvc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Lark - TypeScript MVC framework",
|
|
5
5
|
"files": [
|
|
6
|
-
"dist"
|
|
7
|
-
"lark.d.ts",
|
|
8
|
-
"README.md"
|
|
6
|
+
"dist"
|
|
9
7
|
],
|
|
10
8
|
"exports": {
|
|
11
9
|
".": {
|
|
@@ -48,7 +46,10 @@
|
|
|
48
46
|
"build:tsup": "tsup",
|
|
49
47
|
"clean": "rm -rf dist",
|
|
50
48
|
"format": "prettier -w ./",
|
|
51
|
-
"typecheck": "tsc -p tsconfig.build.json --noEmit"
|
|
49
|
+
"typecheck": "tsc -p tsconfig.build.json --noEmit",
|
|
50
|
+
"test": "vitest run",
|
|
51
|
+
"test:watch": "vitest",
|
|
52
|
+
"test:coverage": "vitest run --coverage"
|
|
52
53
|
},
|
|
53
54
|
"keywords": [
|
|
54
55
|
"lark",
|
|
@@ -62,11 +63,13 @@
|
|
|
62
63
|
"@rollup/plugin-commonjs": "^29.0.2",
|
|
63
64
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
64
65
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
66
|
+
"@vitest/coverage-v8": "4.1.6",
|
|
65
67
|
"rollup": "^4.60.3",
|
|
66
68
|
"rollup-plugin-dts": "^6.4.1",
|
|
67
69
|
"tsup": "^8.5.1",
|
|
68
70
|
"typescript": "^5.8.3",
|
|
69
|
-
"vite": "^8.0.14"
|
|
71
|
+
"vite": "^8.0.14",
|
|
72
|
+
"vitest": "^4.1.6"
|
|
70
73
|
},
|
|
71
74
|
"lint-staged": {
|
|
72
75
|
"*.{json,jsonc,js,cjs,mjs,jsx,ts,cts,mts,tsx,html,vue,css,scss,md,mdx}": [
|