orvyn-lang 0.1.1 → 0.3.0
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/GUIDE.md +149 -0
- package/LANGUAGE.md +877 -24
- package/README.md +227 -131
- package/brand/orvyn-sunset-animated.svg +15 -0
- package/package.json +3 -1
- package/src/cli/orvyn.js +216 -489
- package/src/core/signal.js +104 -6
- package/src/devtools/runtime.js +25 -1
- package/src/lang/a11y.js +102 -0
- package/src/lang/auth.js +239 -0
- package/src/lang/bundle-native.js +10 -6
- package/src/lang/codegen.js +498 -64
- package/src/lang/device.js +41 -0
- package/src/lang/doctor.js +60 -0
- package/src/lang/env.js +27 -0
- package/src/lang/errors.js +513 -0
- package/src/lang/form.js +160 -0
- package/src/lang/index.js +2 -1
- package/src/lang/lexer.js +2 -0
- package/src/lang/list.js +44 -0
- package/src/lang/native/android/MainActivity.kt +43 -4
- package/src/lang/native/android/OrvynDevice.kt +163 -0
- package/src/lang/native/android/OrvynEngine.kt +154 -7
- package/src/lang/native/android/OrvynRenderer.kt +519 -40
- package/src/lang/native/android.js +74 -11
- package/src/lang/native/build.js +130 -60
- package/src/lang/native/config.js +108 -0
- package/src/lang/native/ios/OrvynApp.swift +6 -0
- package/src/lang/native/ios/OrvynEngine.swift +268 -4
- package/src/lang/native/ios/OrvynViews.swift +429 -31
- package/src/lang/native/ios.js +75 -2
- package/src/lang/native-runtime.js +423 -57
- package/src/lang/page.js +52 -0
- package/src/lang/parser.js +243 -15
- package/src/lang/prerender.js +300 -0
- package/src/lang/read-import.js +11 -0
- package/src/lang/router.js +266 -0
- package/src/lang/runtime-shared.js +820 -10
- package/src/lang/runtime.js +375 -52
- package/src/lang/select.js +13 -0
- package/src/lang/server-code.js +233 -0
- package/src/lang/server-export.js +78 -0
- package/src/lang/server-libs.js +53 -0
- package/src/lang/server.js +409 -0
- package/src/lang/test-runner.js +134 -0
- package/src/lang/types.js +312 -0
- package/src/lang/validation.js +55 -0
- package/src/lang/vite-plugin.js +82 -3
- package/src/lang/web-overlay.js +578 -0
- package/src/lang/widgets.js +94 -0
- package/src/lang/words.js +38 -0
- package/src/runtime/mount.js +116 -27
- package/src/runtime/patch.js +90 -11
- package/src/runtime/style.js +11 -1
- package/src/styling/fluid.js +91 -4
- package/src/styling/spec.js +306 -0
- package/src/core/context.js +0 -19
- package/src/core/lifecycle.js +0 -8
- package/src/core/resource.js +0 -27
- package/src/core/router.js +0 -20
- package/src/core/theme.js +0 -10
- package/src/devtools/devicePreview/PreviewFrame.js +0 -214
- package/src/devtools/devicePreview/index.js +0 -6
- package/src/devtools/overlay.js +0 -105
- package/src/runtime/createRenderer.js +0 -22
- package/src/runtime/h.js +0 -93
- package/src/runtime/hydrate.js +0 -59
- package/src/runtime/jsx-dev-runtime.js +0 -7
- package/src/runtime/jsx-runtime.js +0 -13
- package/src/runtime/partialHydration.js +0 -154
- package/src/runtime/platform.js +0 -135
- package/src/runtime/renderToStream.js +0 -127
- package/src/runtime/renderToString.js +0 -121
- package/src/runtime/resume.js +0 -62
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getFluidUtilityDeclarations,
|
|
3
|
-
getResolvedClassName,
|
|
4
|
-
getResponsiveStyleRules,
|
|
5
|
-
getStyleDeclarations,
|
|
6
|
-
isStyleProp
|
|
7
|
-
} from "../styling/fluid.js";
|
|
8
|
-
function isSignal(value) {
|
|
9
|
-
return value && typeof value.get === "function";
|
|
10
|
-
}
|
|
11
|
-
function escapeHtml(value) {
|
|
12
|
-
return String(value).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
13
|
-
}
|
|
14
|
-
function escapeStyleText(value) {
|
|
15
|
-
return String(value).replace(/<\/style/gi, "<\\/style");
|
|
16
|
-
}
|
|
17
|
-
function readValue(value) {
|
|
18
|
-
return isSignal(value) ? value.get() : value;
|
|
19
|
-
}
|
|
20
|
-
function renderAttributes(props = {}) {
|
|
21
|
-
const attrs = [];
|
|
22
|
-
const styles = [];
|
|
23
|
-
const className = getResolvedClassName(props);
|
|
24
|
-
if (className) {
|
|
25
|
-
attrs.push(
|
|
26
|
-
`class="${escapeHtml(className)}"`
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
getFluidUtilityDeclarations(
|
|
30
|
-
readValue(props.className || props.class),
|
|
31
|
-
"css"
|
|
32
|
-
).forEach((declaration) => {
|
|
33
|
-
styles.push(
|
|
34
|
-
`${declaration.property}: ${escapeHtml(declaration.value)}`
|
|
35
|
-
);
|
|
36
|
-
});
|
|
37
|
-
for (const key in props) {
|
|
38
|
-
if (key === "children" || key === "key" || key === "class" || key === "className" || key === "nativeRole" || key.startsWith("on")) {
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
const value = readValue(props[key]);
|
|
42
|
-
if (value === false || value === null || value === void 0) {
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
if (key === "hydrate") {
|
|
46
|
-
if (value === true) {
|
|
47
|
-
attrs.push(`data-orvyn-hydrate="idle"`);
|
|
48
|
-
} else {
|
|
49
|
-
attrs.push(
|
|
50
|
-
`data-orvyn-hydrate="${escapeHtml(value)}"`
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
if (key === "resume") {
|
|
56
|
-
if (value === true) {
|
|
57
|
-
attrs.push(`data-orvyn-resume="true"`);
|
|
58
|
-
} else {
|
|
59
|
-
attrs.push(
|
|
60
|
-
`data-orvyn-resume="${escapeHtml(value)}"`
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
if (isStyleProp(key)) {
|
|
66
|
-
getStyleDeclarations(key, value, "css").forEach((declaration) => {
|
|
67
|
-
styles.push(
|
|
68
|
-
`${declaration.property}: ${escapeHtml(
|
|
69
|
-
declaration.value
|
|
70
|
-
)}`
|
|
71
|
-
);
|
|
72
|
-
});
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
if (value === true) {
|
|
76
|
-
attrs.push(escapeHtml(key));
|
|
77
|
-
} else {
|
|
78
|
-
attrs.push(
|
|
79
|
-
`${escapeHtml(key)}="${escapeHtml(value)}"`
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
if (styles.length > 0) {
|
|
84
|
-
attrs.push(
|
|
85
|
-
`style="${styles.join("; ")}"`
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
return attrs.length > 0 ? ` ${attrs.join(" ")}` : "";
|
|
89
|
-
}
|
|
90
|
-
function renderToString(vnode) {
|
|
91
|
-
if (vnode === null || vnode === void 0 || vnode === false) {
|
|
92
|
-
return "";
|
|
93
|
-
}
|
|
94
|
-
if (Array.isArray(vnode)) {
|
|
95
|
-
return vnode.map(renderToString).join("");
|
|
96
|
-
}
|
|
97
|
-
if (typeof vnode === "string" || typeof vnode === "number") {
|
|
98
|
-
return escapeHtml(vnode);
|
|
99
|
-
}
|
|
100
|
-
if (isSignal(vnode)) {
|
|
101
|
-
return escapeHtml(
|
|
102
|
-
vnode.get()
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
if (typeof vnode.tag === "function") {
|
|
106
|
-
return renderToString(
|
|
107
|
-
vnode.tag({
|
|
108
|
-
...vnode.props,
|
|
109
|
-
children: vnode.children
|
|
110
|
-
})
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
const children = vnode.children.map(renderToString).join("");
|
|
114
|
-
const attrs = renderAttributes(vnode.props);
|
|
115
|
-
const responsiveStyles = getResponsiveStyleRules(vnode.props);
|
|
116
|
-
const responsiveStyleTag = responsiveStyles ? `<style data-orvyn-responsive>${escapeStyleText(responsiveStyles)}</style>` : "";
|
|
117
|
-
return `${responsiveStyleTag}<${vnode.tag}${attrs}>${children}</${vnode.tag}>`;
|
|
118
|
-
}
|
|
119
|
-
export {
|
|
120
|
-
renderToString
|
|
121
|
-
};
|
package/src/runtime/resume.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
restoreSignalState,
|
|
3
|
-
serializeReactiveGraph,
|
|
4
|
-
serializeSignalState
|
|
5
|
-
} from "../core/signal.js";
|
|
6
|
-
import {
|
|
7
|
-
partialHydrate
|
|
8
|
-
} from "./partialHydration.js";
|
|
9
|
-
import { renderToString } from "./renderToString.js";
|
|
10
|
-
const snapshotId = "orvyn-resume-state";
|
|
11
|
-
function escapeJson(value) {
|
|
12
|
-
return JSON.stringify(value).replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/&/g, "\\u0026");
|
|
13
|
-
}
|
|
14
|
-
function createResumeSnapshot() {
|
|
15
|
-
return {
|
|
16
|
-
version: 1,
|
|
17
|
-
signals: serializeSignalState(),
|
|
18
|
-
graph: serializeReactiveGraph()
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
function renderResumeState(snapshot = createResumeSnapshot()) {
|
|
22
|
-
return `<script type="application/json" id="${snapshotId}">${escapeJson(snapshot)}<\/script>`;
|
|
23
|
-
}
|
|
24
|
-
function renderResumable(vnode) {
|
|
25
|
-
return [
|
|
26
|
-
renderToString(vnode),
|
|
27
|
-
renderResumeState()
|
|
28
|
-
].join("");
|
|
29
|
-
}
|
|
30
|
-
function readResumeSnapshot(root = document) {
|
|
31
|
-
const el = root.querySelector?.(`#${snapshotId}`);
|
|
32
|
-
if (!el || !el.textContent) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
return JSON.parse(
|
|
36
|
-
el.textContent
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
function restoreResumeState(snapshot) {
|
|
40
|
-
if (!snapshot) return;
|
|
41
|
-
restoreSignalState(
|
|
42
|
-
snapshot.signals
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
function resume(vnode, el, options = {}) {
|
|
46
|
-
const snapshot = readResumeSnapshot();
|
|
47
|
-
restoreResumeState(snapshot);
|
|
48
|
-
partialHydrate(
|
|
49
|
-
vnode,
|
|
50
|
-
el,
|
|
51
|
-
options
|
|
52
|
-
);
|
|
53
|
-
return snapshot;
|
|
54
|
-
}
|
|
55
|
-
export {
|
|
56
|
-
createResumeSnapshot,
|
|
57
|
-
readResumeSnapshot,
|
|
58
|
-
renderResumable,
|
|
59
|
-
renderResumeState,
|
|
60
|
-
restoreResumeState,
|
|
61
|
-
resume
|
|
62
|
-
};
|