@lark.js/mvc 0.0.15 → 0.0.17
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 +324 -215
- package/dist/chunk-OGPBFCIK.js +105 -0
- package/dist/client.d.cts +63 -0
- package/dist/client.d.ts +10 -34
- package/dist/compiler.cjs +15534 -15854
- package/dist/compiler.d.cts +1 -1
- package/dist/compiler.d.ts +1 -1
- package/dist/compiler.js +15519 -15851
- package/dist/devtool.cjs +2617 -4152
- package/dist/devtool.d.cts +1 -2
- package/dist/devtool.d.ts +1 -2
- package/dist/devtool.js +2543 -4159
- package/dist/index.cjs +4128 -6008
- package/dist/index.d.cts +571 -1291
- package/dist/index.d.ts +571 -1291
- package/dist/index.js +4058 -5976
- package/dist/rspack.cjs +15648 -15935
- package/dist/rspack.d.cts +8 -45
- package/dist/rspack.d.ts +8 -45
- package/dist/rspack.js +15641 -15934
- package/dist/runtime.cjs +79 -79
- package/dist/runtime.js +19 -85
- package/dist/vite.cjs +15841 -15957
- package/dist/vite.d.cts +6 -7
- package/dist/vite.d.ts +6 -7
- package/dist/vite.js +15834 -15955
- package/dist/webpack.cjs +15648 -15985
- package/dist/webpack.d.cts +5 -33
- package/dist/webpack.d.ts +5 -33
- package/dist/webpack.js +15641 -15984
- package/package.json +3 -4
- package/dist/apply-style.d.ts +0 -9
- package/dist/cache.d.ts +0 -69
- package/dist/common.d.ts +0 -64
- package/dist/compiler/compile-template.d.ts +0 -16
- package/dist/compiler/compile-to-vdom-function.d.ts +0 -13
- package/dist/compiler/extract-global-vars.d.ts +0 -17
- package/dist/compiler/template-syntax.d.ts +0 -61
- package/dist/cross-site.d.ts +0 -29
- package/dist/dom.d.ts +0 -45
- package/dist/event-delegator.d.ts +0 -28
- package/dist/event-emitter.d.ts +0 -38
- package/dist/frame.d.ts +0 -143
- package/dist/framework.d.ts +0 -9
- package/dist/hmr.d.ts +0 -53
- package/dist/index.amd.js +0 -6285
- package/dist/index.umd.js +0 -6272
- package/dist/mark.d.ts +0 -26
- package/dist/module-loader.d.ts +0 -20
- package/dist/router.d.ts +0 -14
- package/dist/runtime.amd.js +0 -94
- package/dist/runtime.umd.js +0 -98
- package/dist/service.d.ts +0 -173
- package/dist/state.d.ts +0 -8
- package/dist/store.d.ts +0 -60
- package/dist/types.d.ts +0 -1259
- package/dist/updater.d.ts +0 -90
- package/dist/url-state.d.ts +0 -32
- package/dist/utils.d.ts +0 -90
- package/dist/vdom.d.ts +0 -45
- package/dist/view-registry.d.ts +0 -20
- package/dist/view.d.ts +0 -214
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// src/common.ts
|
|
2
|
+
var globalCounter = 0;
|
|
3
|
+
var SPLITTER = String.fromCharCode(30);
|
|
4
|
+
var RouterEvents = {
|
|
5
|
+
CHANGE: "change",
|
|
6
|
+
CHANGED: "changed",
|
|
7
|
+
PAGE_UNLOAD: "page_unload"
|
|
8
|
+
};
|
|
9
|
+
var LARK_VIEW = "v-lark";
|
|
10
|
+
var EVENT_METHOD_REGEXP = new RegExp(
|
|
11
|
+
`(?:([\\w-]+)${SPLITTER})?([^(]+)\\(([\\s\\S]*?)?\\)`
|
|
12
|
+
);
|
|
13
|
+
var VIEW_EVENT_METHOD_REGEXP = /^(\$?)([\w]*)<(.*?)>(?:<([\w ,]*)>)?$/;
|
|
14
|
+
var URL_TRIM_HASH_REGEXP = /(?:^.*\/\/[^/]+|#.*$)/gi;
|
|
15
|
+
var URL_TRIM_QUERY_REGEXP = /^[^#]*#?!?/;
|
|
16
|
+
var URL_PARAM_REGEXP = /([^=&?/#]+)=?([^&#?]*)/g;
|
|
17
|
+
var IS_URL_PARAMS = /(?!^)=|&/;
|
|
18
|
+
var URL_QUERY_HASH_REGEXP = /[#?].*$/;
|
|
19
|
+
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
20
|
+
var MATH_NS = "http://www.w3.org/1998/Math/MathML";
|
|
21
|
+
var TAG_NAME_REGEXP = /<([a-z][^/\0>\x20\t\r\n\f]+)/i;
|
|
22
|
+
var V_TEXT_NODE = 0;
|
|
23
|
+
var VDOM_NS_MAP = {
|
|
24
|
+
svg: SVG_NS,
|
|
25
|
+
math: MATH_NS
|
|
26
|
+
};
|
|
27
|
+
function nextCounter() {
|
|
28
|
+
return ++globalCounter;
|
|
29
|
+
}
|
|
30
|
+
var HTML_ENT_MAP = {
|
|
31
|
+
"&": "amp",
|
|
32
|
+
"<": "lt",
|
|
33
|
+
">": "gt",
|
|
34
|
+
'"': "#34",
|
|
35
|
+
"'": "#39",
|
|
36
|
+
"`": "#96"
|
|
37
|
+
};
|
|
38
|
+
var HTML_ENT_REGEXP = /[&<>"'`]/g;
|
|
39
|
+
function strSafe(v) {
|
|
40
|
+
return String(v == null ? "" : v);
|
|
41
|
+
}
|
|
42
|
+
function encodeHTML(v) {
|
|
43
|
+
return String(v == null ? "" : v).replace(
|
|
44
|
+
HTML_ENT_REGEXP,
|
|
45
|
+
(m) => "&" + HTML_ENT_MAP[m] + ";"
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
var URI_ENT_MAP = {
|
|
49
|
+
"!": "%21",
|
|
50
|
+
"'": "%27",
|
|
51
|
+
"(": "%28",
|
|
52
|
+
")": "%29",
|
|
53
|
+
"*": "%2A"
|
|
54
|
+
};
|
|
55
|
+
var URI_ENT_REGEXP = /[!')(*]/g;
|
|
56
|
+
function encodeURIExtra(v) {
|
|
57
|
+
return encodeURIComponent(strSafe(v)).replace(URI_ENT_REGEXP, (m) => URI_ENT_MAP[m]);
|
|
58
|
+
}
|
|
59
|
+
var QUOTE_ENT_REGEXP = /['"\\]/g;
|
|
60
|
+
function encodeQuote(v) {
|
|
61
|
+
return strSafe(v).replace(QUOTE_ENT_REGEXP, "\\$&");
|
|
62
|
+
}
|
|
63
|
+
function refFn(ref, value, key) {
|
|
64
|
+
const counter = ref[SPLITTER];
|
|
65
|
+
for (let i = counter; --i; ) {
|
|
66
|
+
key = SPLITTER + i;
|
|
67
|
+
if (ref[key] === value) return key;
|
|
68
|
+
}
|
|
69
|
+
key = SPLITTER + ref[SPLITTER]++;
|
|
70
|
+
ref[key] = value;
|
|
71
|
+
return key;
|
|
72
|
+
}
|
|
73
|
+
function isRefToken(s) {
|
|
74
|
+
if (s.length < 2 || s[0] !== SPLITTER) return false;
|
|
75
|
+
for (let i = 1; i < s.length; i++) {
|
|
76
|
+
const c = s.charCodeAt(i);
|
|
77
|
+
if (c < "0".charCodeAt(0) || c > "9".charCodeAt(0)) return false;
|
|
78
|
+
}
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export {
|
|
83
|
+
SPLITTER,
|
|
84
|
+
RouterEvents,
|
|
85
|
+
LARK_VIEW,
|
|
86
|
+
EVENT_METHOD_REGEXP,
|
|
87
|
+
VIEW_EVENT_METHOD_REGEXP,
|
|
88
|
+
URL_TRIM_HASH_REGEXP,
|
|
89
|
+
URL_TRIM_QUERY_REGEXP,
|
|
90
|
+
URL_PARAM_REGEXP,
|
|
91
|
+
IS_URL_PARAMS,
|
|
92
|
+
URL_QUERY_HASH_REGEXP,
|
|
93
|
+
SVG_NS,
|
|
94
|
+
MATH_NS,
|
|
95
|
+
TAG_NAME_REGEXP,
|
|
96
|
+
V_TEXT_NODE,
|
|
97
|
+
VDOM_NS_MAP,
|
|
98
|
+
nextCounter,
|
|
99
|
+
strSafe,
|
|
100
|
+
encodeHTML,
|
|
101
|
+
encodeURIExtra,
|
|
102
|
+
encodeQuote,
|
|
103
|
+
refFn,
|
|
104
|
+
isRefToken
|
|
105
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
FrameApi,
|
|
3
|
+
FrameworkApi,
|
|
4
|
+
StateApi,
|
|
5
|
+
RouterApi,
|
|
6
|
+
CrossSiteConfig,
|
|
7
|
+
ViewTemplate,
|
|
8
|
+
VDomTemplate,
|
|
9
|
+
} from "./types";
|
|
10
|
+
import type { Frame } from "./frame";
|
|
11
|
+
import type { View } from "./view";
|
|
12
|
+
declare global {
|
|
13
|
+
interface Window {
|
|
14
|
+
/** Cross-site configuration injected by build tools */
|
|
15
|
+
crossSites?: CrossSiteConfig[];
|
|
16
|
+
scheduler?: Scheduler;
|
|
17
|
+
}
|
|
18
|
+
interface ImportMeta {
|
|
19
|
+
/** HMR context provided by Vite / webpack dev server. Undefined in production. */
|
|
20
|
+
hot?: {
|
|
21
|
+
accept(cb?: (mod: { default?: unknown } | undefined) => void): void;
|
|
22
|
+
dispose(cb: (data: unknown) => void): void;
|
|
23
|
+
invalidate(): void;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
interface HTMLElement {
|
|
27
|
+
/** Bound frame instance */
|
|
28
|
+
frame?: FrameApi | undefined;
|
|
29
|
+
/** Whether frame is bound to this element (1 = bound) */
|
|
30
|
+
frameBound?: number;
|
|
31
|
+
/** Whether auto-generated ID was assigned */
|
|
32
|
+
autoId?: number;
|
|
33
|
+
/** View rendered flag for selector matching */
|
|
34
|
+
viewRendered?: number;
|
|
35
|
+
/** Range frame ID for event delegation */
|
|
36
|
+
rangeFrameId?: string;
|
|
37
|
+
/** Range element guid for event delegation */
|
|
38
|
+
rangeElementGuid?: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface Element {
|
|
42
|
+
/** DOM diff cached compare key flag */
|
|
43
|
+
compareKeyCached?: number | undefined;
|
|
44
|
+
/** DOM diff cached compare key */
|
|
45
|
+
cachedCompareKey?: string | undefined;
|
|
46
|
+
"v-lark"?: string | undefined;
|
|
47
|
+
|
|
48
|
+
// @lark.js/sentry
|
|
49
|
+
"s-lark-ev"?: string | undefined;
|
|
50
|
+
"s-lark-msg"?: string | undefined;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// CSS module type declarations
|
|
55
|
+
declare module "*.css" {
|
|
56
|
+
const content: string;
|
|
57
|
+
export default content;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
declare module "*.html" {
|
|
61
|
+
const template: ViewTemplate | VDomTemplate;
|
|
62
|
+
export default template;
|
|
63
|
+
}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,35 +1,18 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
FrameApi,
|
|
3
|
+
FrameworkApi,
|
|
4
|
+
StateApi,
|
|
5
|
+
RouterApi,
|
|
6
6
|
CrossSiteConfig,
|
|
7
|
+
ViewTemplate,
|
|
8
|
+
VDomTemplate,
|
|
7
9
|
} from "./types";
|
|
8
10
|
import type { Frame } from "./frame";
|
|
9
11
|
import type { View } from "./view";
|
|
10
12
|
declare global {
|
|
11
13
|
interface Window {
|
|
12
|
-
/** Lark Framework object */
|
|
13
|
-
__lark_Framework?: FrameworkInterface;
|
|
14
|
-
/** Lark State object */
|
|
15
|
-
__lark_State?: StateInterface;
|
|
16
|
-
/** Lark Router object */
|
|
17
|
-
__lark_Router?: RouterInterface;
|
|
18
|
-
/** Lark Frame class */
|
|
19
|
-
__lark_Frame?: typeof Frame;
|
|
20
|
-
/** Lark View class */
|
|
21
|
-
__lark_View?: typeof View;
|
|
22
|
-
/** Invalidate a view class from the registry (HMR support) */
|
|
23
|
-
__lark_invalidateViewClass?: (viewPath: string) => void;
|
|
24
|
-
/** Get the view class registry (HMR/debug support) */
|
|
25
|
-
__lark_getViewClassRegistry?: () => Record<string, typeof View>;
|
|
26
|
-
/** Register a view class (HMR support) */
|
|
27
|
-
__lark_registerViewClass?: (
|
|
28
|
-
viewPath: string,
|
|
29
|
-
ViewClass: typeof View,
|
|
30
|
-
) => void;
|
|
31
14
|
/** Cross-site configuration injected by build tools */
|
|
32
|
-
|
|
15
|
+
crossSites?: CrossSiteConfig[];
|
|
33
16
|
scheduler?: Scheduler;
|
|
34
17
|
}
|
|
35
18
|
interface ImportMeta {
|
|
@@ -42,7 +25,7 @@ declare global {
|
|
|
42
25
|
}
|
|
43
26
|
interface HTMLElement {
|
|
44
27
|
/** Bound frame instance */
|
|
45
|
-
frame?:
|
|
28
|
+
frame?: FrameApi | undefined;
|
|
46
29
|
/** Whether frame is bound to this element (1 = bound) */
|
|
47
30
|
frameBound?: number;
|
|
48
31
|
/** Whether auto-generated ID was assigned */
|
|
@@ -74,14 +57,7 @@ declare module "*.css" {
|
|
|
74
57
|
export default content;
|
|
75
58
|
}
|
|
76
59
|
|
|
77
|
-
// HTML template module declarations (Lark templates - compiled to functions)
|
|
78
60
|
declare module "*.html" {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
// viewId: string,
|
|
82
|
-
// refData: unknown,
|
|
83
|
-
// ) => string;
|
|
84
|
-
// export default template;
|
|
85
|
-
const content: string;
|
|
86
|
-
export default content;
|
|
61
|
+
const template: ViewTemplate | VDomTemplate;
|
|
62
|
+
export default template;
|
|
87
63
|
}
|