ranui 0.1.10-alpha.7 → 0.2.0-alpha.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/README.md +397 -0
- package/README.zh-CN.md +369 -0
- package/dist/assets/image/failImage.d.ts +2 -0
- package/dist/bin/generate-component-api.d.ts +1 -0
- package/dist/bin/generate-style-docs.d.ts +1 -0
- package/dist/build/config.bundle.d.ts +2 -0
- package/dist/build/config.d.ts +3 -0
- package/dist/build/config.es.d.ts +2 -0
- package/dist/build/config.umd.d.ts +1 -0
- package/dist/builder.d.ts +11 -0
- package/dist/builder.js +39 -0
- package/dist/button-DukaD6uL.js +117 -0
- package/dist/button.js +3 -5
- package/dist/card-DQUJoDUQ.js +60 -0
- package/dist/card.js +5 -0
- package/dist/checkbox-iHZQb-yQ.js +94 -0
- package/dist/checkbox.js +3 -5
- package/dist/colorpicker-Ch67dWa_.js +302 -0
- package/dist/colorpicker.js +3 -9
- package/dist/components/button/index.d.ts +44 -0
- package/dist/components/card/index.d.ts +21 -0
- package/dist/components/checkbox/index.d.ts +35 -0
- package/dist/components/colorpicker/index.d.ts +88 -0
- package/dist/components/dropdown/index.d.ts +32 -0
- package/dist/components/form/index.d.ts +15 -0
- package/dist/components/icon/index.d.ts +58 -0
- package/dist/components/image/index.d.ts +25 -0
- package/dist/components/input/index.d.ts +229 -0
- package/dist/components/link/index.d.ts +21 -0
- package/dist/components/loading/index.d.ts +76 -0
- package/dist/components/math/index.d.ts +16 -0
- package/dist/components/message/container.d.ts +8 -0
- package/dist/components/message/index.d.ts +32 -0
- package/dist/components/modal/index.d.ts +100 -0
- package/dist/components/player/core/constants.d.ts +5 -0
- package/dist/components/player/core/controller.d.ts +33 -0
- package/dist/components/player/core/events.d.ts +10 -0
- package/dist/components/player/core/fullscreen.d.ts +5 -0
- package/dist/components/player/core/levels.d.ts +20 -0
- package/dist/components/player/core/media.d.ts +50 -0
- package/dist/components/player/core/playback.d.ts +14 -0
- package/dist/components/player/core/progress.d.ts +2 -0
- package/dist/components/player/core/state.d.ts +27 -0
- package/dist/components/player/core/view.d.ts +39 -0
- package/dist/components/player/index.d.ts +277 -0
- package/dist/components/popover/content/index.d.ts +12 -0
- package/dist/components/popover/index.d.ts +95 -0
- package/dist/components/progress/index.d.ts +40 -0
- package/dist/components/radar/index.d.ts +52 -0
- package/dist/components/route/index.d.ts +26 -0
- package/dist/components/router/index.d.ts +24 -0
- package/dist/components/scratch/index.d.ts +19 -0
- package/dist/components/section/index.d.ts +23 -0
- package/dist/components/select/dropdown-item/index.d.ts +21 -0
- package/dist/components/select/index.d.ts +135 -0
- package/dist/components/select/option/index.d.ts +19 -0
- package/dist/components/skeleton/index.d.ts +13 -0
- package/dist/components/tab/index.d.ts +58 -0
- package/dist/components/tabpane/index.d.ts +33 -0
- package/dist/demo/i18n.d.ts +4 -0
- package/dist/demo/index.d.ts +3 -0
- package/dist/demo/register-icons.d.ts +1 -0
- package/dist/dropdown-C5362qTy.js +82 -0
- package/dist/dropdown.js +6 -0
- package/dist/events-C59wGdni.js +30 -0
- package/dist/factory-BdsO0dEW.js +165 -0
- package/dist/form-05Lxxl3D.js +44 -0
- package/dist/form.js +5 -0
- package/dist/icon-DmoEnao5.js +165 -0
- package/dist/icon.js +4 -4
- package/dist/{index-KS2nvVcO.js → image-6GayFDqX.js} +58 -71
- package/dist/image.js +3 -2
- package/dist/index.cjs +35 -0
- package/dist/index.d.ts +277 -116
- package/dist/index.iife.js +306 -0
- package/dist/index.js +78 -38
- package/dist/input-DoraIb3x.js +198 -0
- package/dist/input.js +2 -3
- package/dist/katex-es-Bpesphgp.js +23682 -0
- package/dist/katex-es-Cnq5Pk8K.cjs +261 -0
- package/dist/link-BW-gvrpN.js +77 -0
- package/dist/link.js +6 -0
- package/dist/loading-Mko22ncl.js +206 -0
- package/dist/loading.js +4 -6
- package/dist/math-B5PpSnFR.js +52 -0
- package/dist/math.js +2 -4
- package/dist/message-CQENvkoi.js +137 -0
- package/dist/message.js +3 -4
- package/dist/mocks-CMGoftIc.js +179 -0
- package/dist/modal-DruDj3AB.js +350 -0
- package/dist/modal.js +3 -2
- package/dist/player-CvfmwWUa.js +13536 -0
- package/dist/player.js +3 -6
- package/dist/playwright.config.d.ts +2 -0
- package/dist/plugins/load-svg.d.ts +9 -0
- package/dist/popover-BCvHwLZb.js +213 -0
- package/dist/popover.js +3 -5
- package/dist/progress-BWkNf2J5.js +123 -0
- package/dist/progress.js +3 -5
- package/dist/radar-CWsawt2g.js +181 -0
- package/dist/radar.js +3 -4
- package/dist/ranui.css +1 -0
- package/dist/route-BY_E6-2C.js +88 -0
- package/dist/route.js +6 -0
- package/dist/router-BDcv4F-2.js +79 -0
- package/dist/router.js +6 -0
- package/dist/scratch-Dbd9G6Q6.js +60 -0
- package/dist/scratch.js +4 -0
- package/dist/section-CNTvgdQ-.js +63 -0
- package/dist/section.js +5 -0
- package/dist/select-BmhCUTLb.js +433 -0
- package/dist/select.js +3 -8
- package/dist/signal-XHfNsQNW.js +57 -0
- package/dist/skeleton-DPv9nFhL.js +32 -0
- package/dist/skeleton.js +3 -2
- package/dist/ssg.js +21 -0
- package/dist/ssr-DSGwPtEd.js +34 -0
- package/dist/ssr-stream.d.ts +1 -0
- package/dist/ssr-stream.js +87 -0
- package/dist/ssr.d.ts +1 -0
- package/dist/ssr.js +7 -0
- package/dist/style.d.ts +1 -0
- package/dist/style.js +0 -0
- package/dist/tab-C9swK-hm.js +185 -0
- package/dist/tab.js +3 -4
- package/dist/tabpane-B_M-Jokw.js +87 -0
- package/dist/tabpane.js +3 -2
- package/dist/test/e2e/button.spec.d.ts +1 -0
- package/dist/test/e2e/checkbox.spec.d.ts +1 -0
- package/dist/test/e2e/helpers.d.ts +13 -0
- package/dist/test/e2e/icon.spec.d.ts +1 -0
- package/dist/test/e2e/image.spec.d.ts +1 -0
- package/dist/test/e2e/input.spec.d.ts +1 -0
- package/dist/test/e2e/loading.spec.d.ts +1 -0
- package/dist/test/e2e/message.spec.d.ts +1 -0
- package/dist/test/e2e/modal.spec.d.ts +1 -0
- package/dist/test/e2e/popover.spec.d.ts +1 -0
- package/dist/test/e2e/progress.spec.d.ts +1 -0
- package/dist/test/e2e/radar.spec.d.ts +1 -0
- package/dist/test/e2e/select.spec.d.ts +1 -0
- package/dist/test/e2e/skeleton.spec.d.ts +1 -0
- package/dist/test/e2e/tab.spec.d.ts +1 -0
- package/dist/test/e2e/visual/colorpicker.spec.d.ts +1 -0
- package/dist/test/e2e/visual/components.spec.d.ts +1 -0
- package/dist/test/e2e/visual/player.spec.d.ts +1 -0
- package/dist/test/integration/composition.test.d.ts +23 -0
- package/dist/test/setup.d.ts +0 -0
- package/dist/test/ssr/builder.core.ssr.test.d.ts +1 -0
- package/dist/test/ssr/builder.factory.ssr.test.d.ts +1 -0
- package/dist/test/ssr/builder.mocks.test.d.ts +1 -0
- package/dist/test/ssr/components/button.test.d.ts +1 -0
- package/dist/test/ssr/css-vars.test.d.ts +1 -0
- package/dist/test/ssr/registry.test.d.ts +1 -0
- package/dist/test/ssr/router.ssg.test.d.ts +2 -0
- package/dist/test/ssr/snapshots/button.test.d.ts +1 -0
- package/dist/test/ssr/stream.test.d.ts +2 -0
- package/dist/test/ssr/theme.tokens.ssr.test.d.ts +1 -0
- package/dist/test/unit/builder.core.browser.test.d.ts +1 -0
- package/dist/test/unit/builder.escape.test.d.ts +1 -0
- package/dist/test/unit/builder.selectors.test.d.ts +1 -0
- package/dist/test/unit/button.contract.test.d.ts +1 -0
- package/dist/test/unit/card.contract.test.d.ts +1 -0
- package/dist/test/unit/checkbox.contract.test.d.ts +1 -0
- package/dist/test/unit/colorpicker.color.utils.test.d.ts +1 -0
- package/dist/test/unit/colorpicker.contract.test.d.ts +1 -0
- package/dist/test/unit/colorpicker.methods.test.d.ts +1 -0
- package/dist/test/unit/component.helpers.test.d.ts +1 -0
- package/dist/test/unit/dropdown-item.contract.test.d.ts +1 -0
- package/dist/test/unit/dropdown.contract.test.d.ts +1 -0
- package/dist/test/unit/form.contract.test.d.ts +1 -0
- package/dist/test/unit/helpers/component.d.ts +3 -0
- package/dist/test/unit/helpers/dom.d.ts +2 -0
- package/dist/test/unit/icon.contract.test.d.ts +1 -0
- package/dist/test/unit/image.contract.test.d.ts +1 -0
- package/dist/test/unit/input.contract.test.d.ts +1 -0
- package/dist/test/unit/link.contract.test.d.ts +1 -0
- package/dist/test/unit/loading.contract.test.d.ts +1 -0
- package/dist/test/unit/math.contract.test.d.ts +1 -0
- package/dist/test/unit/message.component.test.d.ts +1 -0
- package/dist/test/unit/message.container.test.d.ts +1 -0
- package/dist/test/unit/modal.contract.test.d.ts +1 -0
- package/dist/test/unit/option.contract.test.d.ts +1 -0
- package/dist/test/unit/package-exports.source.test.d.ts +1 -0
- package/dist/test/unit/player-controls.test.d.ts +1 -0
- package/dist/test/unit/player-core.test.d.ts +1 -0
- package/dist/test/unit/player-event-handlers.test.d.ts +1 -0
- package/dist/test/unit/player-events.test.d.ts +1 -0
- package/dist/test/unit/player-fullscreen.test.d.ts +1 -0
- package/dist/test/unit/player-interactions.test.d.ts +1 -0
- package/dist/test/unit/player-levels.test.d.ts +1 -0
- package/dist/test/unit/player-media.test.d.ts +1 -0
- package/dist/test/unit/player-playback.test.d.ts +1 -0
- package/dist/test/unit/player.contract.test.d.ts +1 -0
- package/dist/test/unit/popover-accessibility.test.d.ts +1 -0
- package/dist/test/unit/popover.contract.test.d.ts +2 -0
- package/dist/test/unit/progress.contract.test.d.ts +1 -0
- package/dist/test/unit/radar.contract.test.d.ts +1 -0
- package/dist/test/unit/route.contract.test.d.ts +1 -0
- package/dist/test/unit/router.contract.test.d.ts +2 -0
- package/dist/test/unit/scratch.contract.test.d.ts +1 -0
- package/dist/test/unit/select-accessibility.test.d.ts +1 -0
- package/dist/test/unit/select-option.contract.test.d.ts +1 -0
- package/dist/test/unit/select.contract.test.d.ts +1 -0
- package/dist/test/unit/skeleton.contract.test.d.ts +1 -0
- package/dist/test/unit/ssr.test.d.ts +1 -0
- package/dist/test/unit/tab.contract.test.d.ts +2 -0
- package/dist/test/unit/theme.semantic-tokens.test.d.ts +1 -0
- package/dist/test/unit/theme.skin-tokens.test.d.ts +1 -0
- package/dist/test/unit/utils.dom.test.d.ts +1 -0
- package/dist/test/unit/utils.error.test.d.ts +1 -0
- package/dist/test/unit/utils.i18n.test.d.ts +1 -0
- package/dist/test/unit/utils.image.test.d.ts +1 -0
- package/dist/test/unit/utils.math.test.d.ts +1 -0
- package/dist/test/unit/utils.router.test.d.ts +1 -0
- package/dist/test/unit/utils.signal.test.d.ts +1 -0
- package/dist/test/unit/utils.ssr-stream.test.d.ts +1 -0
- package/dist/test/unit/utils.style.test.d.ts +1 -0
- package/dist/test/unit/utils.theme.test.d.ts +1 -0
- package/dist/test/unit/utils.tween.test.d.ts +1 -0
- package/dist/tsconfig.json +9 -9
- package/dist/typings.d.ts +163 -116
- package/dist/utils/builder/core.d.ts +70 -0
- package/dist/utils/builder/env.d.ts +1 -0
- package/dist/utils/builder/escape.d.ts +2 -0
- package/dist/utils/builder/events.d.ts +55 -0
- package/dist/utils/builder/factory.d.ts +18 -0
- package/dist/utils/builder/index.d.ts +9 -0
- package/dist/utils/builder/mocks.d.ts +62 -0
- package/dist/utils/builder/selectors.d.ts +4 -0
- package/dist/utils/builder/signal.d.ts +87 -0
- package/dist/utils/color.d.ts +52 -0
- package/dist/utils/component.d.ts +16 -0
- package/dist/utils/dom.d.ts +39 -0
- package/dist/utils/error.d.ts +6 -0
- package/dist/utils/i18n/index.d.ts +53 -0
- package/dist/utils/i18n.js +88 -0
- package/dist/utils/image.d.ts +39 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/math.d.ts +26 -0
- package/dist/utils/router/index.d.ts +128 -0
- package/dist/utils/router.js +197 -0
- package/dist/utils/ssg.d.ts +49 -0
- package/dist/utils/ssr-registry.d.ts +8 -0
- package/dist/utils/ssr-stream.d.ts +23 -0
- package/dist/utils/ssr.d.ts +17 -0
- package/dist/utils/style.d.ts +12 -0
- package/dist/utils/theme.d.ts +9 -0
- package/dist/utils/tween.d.ts +21 -0
- package/dist/utils/video.d.ts +40 -0
- package/dist/utils-D4pPF77E.js +689 -0
- package/dist/vite.config.d.ts +6 -0
- package/dist/vitest.config.d.ts +2 -0
- package/dist/vitest.config.ssr.d.ts +2 -0
- package/docs/COMPONENTS.md +326 -0
- package/docs/DESIGN.md +182 -0
- package/docs/style-tokens-public.md +880 -0
- package/package.json +138 -74
- package/typings.d.ts +163 -116
- package/dist/_commonjs-dynamic-modules-DLbDWi6a.js +0 -12
- package/dist/add-user-BN1JlY7e.js +0 -4
- package/dist/arrow-down-Beig7FXI.js +0 -652
- package/dist/book-nTEFXU2x.js +0 -4
- package/dist/check-circle-fill-B_pd8ZSs.js +0 -4
- package/dist/check-circle-szyAJiap.js +0 -4
- package/dist/close-CFnkhudp.js +0 -4
- package/dist/close-circle-CwmuN2C6.js +0 -4
- package/dist/close-circle-fill-jSqPPw9i.js +0 -4
- package/dist/colz-DJZvo_8B.js +0 -232
- package/dist/docx-CHkPTdGU.js +0 -3665
- package/dist/drop-4j4abxje.js +0 -36
- package/dist/eye-D_mEt17f.js +0 -4
- package/dist/eye-close-BVr3NJtg.js +0 -4
- package/dist/home-BUQ4USMk.js +0 -4
- package/dist/iconShadowless.js +0 -6
- package/dist/index-BZR0HaP2.js +0 -40
- package/dist/index-Bl6-5Hp8.js +0 -63701
- package/dist/index-C0Xh8vJ3.js +0 -146
- package/dist/index-C4Sv0T51.js +0 -495
- package/dist/index-CGEx9VOA.js +0 -17106
- package/dist/index-CILRcFIV.js +0 -100
- package/dist/index-CQTJoWhb.js +0 -19
- package/dist/index-CWNtaUwu.js +0 -308
- package/dist/index-CjSKJE6S.js +0 -158
- package/dist/index-Ck9TOxFh.js +0 -279
- package/dist/index-CryFK9u4.js +0 -320
- package/dist/index-D4twPONc.js +0 -187
- package/dist/index-D83djTVa.js +0 -659
- package/dist/index-DAxs7Dd2.js +0 -119
- package/dist/index-DBecKjmY.js +0 -279
- package/dist/index-DC5EA657.js +0 -91
- package/dist/index-DHTzB_6b.js +0 -9575
- package/dist/index-DL-1C2RQ.js +0 -496
- package/dist/index-DN-kAx-A.js +0 -72
- package/dist/index-TlwIh-o2.js +0 -306
- package/dist/index-WfFw4LJT.js +0 -490
- package/dist/index-lLO-8KJ1.js +0 -204
- package/dist/index-oD-_YELB.js +0 -511
- package/dist/index-qvcQTV5_.js +0 -105
- package/dist/info-circle-COnL5bTJ.js +0 -4
- package/dist/info-circle-fill-CFeVMdci.js +0 -4
- package/dist/inputShadowless.js +0 -6
- package/dist/jszip.min-Dhs3nUkD.js +0 -2346
- package/dist/katex-es-B5r5vt3m.js +0 -14628
- package/dist/loading-Dcc5RApI.js +0 -4
- package/dist/loading-scene-BMc2wqKm.js +0 -4
- package/dist/lock-Cr7BnmWN.js +0 -4
- package/dist/message-D36_Zo2l.js +0 -4
- package/dist/pdf-Cx0VWKFo.js +0 -118
- package/dist/power-off-lQRbiBak.js +0 -4
- package/dist/preview-CJbz9GjO.js +0 -4
- package/dist/preview.js +0 -7
- package/dist/selectShadowless.js +0 -564
- package/dist/setting-DemlgzVC.js +0 -4
- package/dist/shadowless.js +0 -8
- package/dist/sprite-CH2zLtZy.js +0 -141
- package/dist/style.css +0 -1
- package/dist/team-tl4NJXPC.js +0 -4
- package/dist/umd/index.umd.cjs +0 -60
- package/dist/umd/shadowless/shadowless.umd.cjs +0 -1
- package/dist/umd/shadowless/style.css +0 -1
- package/dist/umd/style.css +0 -1
- package/dist/unlock-CeU74z9n.js +0 -4
- package/dist/user-B-eVXwuk.js +0 -4
- package/dist/warning-circle-DDUgEDIv.js +0 -4
- package/dist/warning-circle-fill-lODUKz0i.js +0 -4
- package/readme.md +0 -176
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
var o = null, r = null, u = null;
|
|
2
|
+
function m() {
|
|
3
|
+
return u;
|
|
4
|
+
}
|
|
5
|
+
function v(e) {
|
|
6
|
+
u = e;
|
|
7
|
+
}
|
|
8
|
+
function b() {
|
|
9
|
+
u = null;
|
|
10
|
+
}
|
|
11
|
+
function f(e) {
|
|
12
|
+
const t = {};
|
|
13
|
+
return e && new URLSearchParams(e.startsWith("?") ? e.slice(1) : e).forEach((i, n) => {
|
|
14
|
+
t[n] = i;
|
|
15
|
+
}), t;
|
|
16
|
+
}
|
|
17
|
+
function l() {
|
|
18
|
+
return typeof document < "u" && "startViewTransition" in document;
|
|
19
|
+
}
|
|
20
|
+
function _(e) {
|
|
21
|
+
l() ? document.startViewTransition(e) : e();
|
|
22
|
+
}
|
|
23
|
+
function h() {
|
|
24
|
+
typeof document > "u" || r && document.head.contains(r) || (r = document.createElement("style"), r.textContent = "@view-transition { navigation: auto; }", document.head.appendChild(r));
|
|
25
|
+
}
|
|
26
|
+
function d() {
|
|
27
|
+
r?.remove(), r = null;
|
|
28
|
+
}
|
|
29
|
+
function p(e) {
|
|
30
|
+
return e === !0 || e === "spa" || e === "both";
|
|
31
|
+
}
|
|
32
|
+
function w(e) {
|
|
33
|
+
return e === "mpa" || e === "both";
|
|
34
|
+
}
|
|
35
|
+
var g = class {
|
|
36
|
+
_mode;
|
|
37
|
+
_base;
|
|
38
|
+
_routes;
|
|
39
|
+
_vtMode;
|
|
40
|
+
_beforeGuards = [];
|
|
41
|
+
_afterGuards = [];
|
|
42
|
+
_changeHandlers = [];
|
|
43
|
+
_pageSwapHandlers = [];
|
|
44
|
+
_pageRevealHandlers = [];
|
|
45
|
+
_components = /* @__PURE__ */ new Set();
|
|
46
|
+
_current = null;
|
|
47
|
+
_mpaActive = !1;
|
|
48
|
+
constructor(e = {}) {
|
|
49
|
+
this._mode = e.mode ?? "history", this._base = e.base ?? "", this._routes = e.routes ?? [], this._vtMode = e.viewTransition, w(this._vtMode) && this._enableMpa();
|
|
50
|
+
}
|
|
51
|
+
get mode() {
|
|
52
|
+
return this._mode;
|
|
53
|
+
}
|
|
54
|
+
get base() {
|
|
55
|
+
return this._base;
|
|
56
|
+
}
|
|
57
|
+
get routes() {
|
|
58
|
+
return [...this._routes];
|
|
59
|
+
}
|
|
60
|
+
get currentRoute() {
|
|
61
|
+
return this._current;
|
|
62
|
+
}
|
|
63
|
+
_matchConfigPath(e, t) {
|
|
64
|
+
const i = [], n = t.path.split("/").map((s) => s.startsWith(":") ? (i.push(s.slice(1)), "([^/]+)") : s === "*" ? "(.*)" : s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("/");
|
|
65
|
+
return (t.exact ? new RegExp(`^${n}$`) : new RegExp(`^${n}(?:/.*)?$`)).test(e);
|
|
66
|
+
}
|
|
67
|
+
matchRoute(e) {
|
|
68
|
+
return this._routes.find((t) => this._matchConfigPath(e, t)) ?? null;
|
|
69
|
+
}
|
|
70
|
+
getStaticPaths() {
|
|
71
|
+
return this._routes.map((e) => e.path);
|
|
72
|
+
}
|
|
73
|
+
_enableMpa() {
|
|
74
|
+
this._mpaActive || (this._mpaActive = !0, h(), typeof window < "u" && (window.addEventListener("pageswap", this._onPageSwap), window.addEventListener("pagereveal", this._onPageReveal)));
|
|
75
|
+
}
|
|
76
|
+
_disableMpa() {
|
|
77
|
+
this._mpaActive && (this._mpaActive = !1, d(), typeof window < "u" && (window.removeEventListener("pageswap", this._onPageSwap), window.removeEventListener("pagereveal", this._onPageReveal)));
|
|
78
|
+
}
|
|
79
|
+
_onPageSwap = (e) => {
|
|
80
|
+
this._pageSwapHandlers.forEach((t) => t(e));
|
|
81
|
+
};
|
|
82
|
+
_onPageReveal = (e) => {
|
|
83
|
+
this._pageRevealHandlers.forEach((t) => t(e));
|
|
84
|
+
};
|
|
85
|
+
_bind(e) {
|
|
86
|
+
this._components.add(e);
|
|
87
|
+
}
|
|
88
|
+
_unbind(e) {
|
|
89
|
+
this._components.delete(e);
|
|
90
|
+
}
|
|
91
|
+
_buildLocation(e) {
|
|
92
|
+
const t = e.indexOf("?"), i = t === -1 ? e : e.slice(0, t), n = t === -1 ? "" : e.slice(t + 1);
|
|
93
|
+
return {
|
|
94
|
+
path: i || "/",
|
|
95
|
+
params: {},
|
|
96
|
+
query: f(n),
|
|
97
|
+
fullPath: e || "/"
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
_getCurrentPath() {
|
|
101
|
+
if (typeof window > "u") return "/";
|
|
102
|
+
if (this._mode === "hash") return window.location.hash.slice(1) || "/";
|
|
103
|
+
const e = window.location.pathname, t = this._base;
|
|
104
|
+
return (t && e.startsWith(t) ? e.slice(t.length) || "/" : e) + (window.location.search || "");
|
|
105
|
+
}
|
|
106
|
+
_notify() {
|
|
107
|
+
const e = this._buildLocation(this._getCurrentPath()), t = this._current;
|
|
108
|
+
this._current = e;
|
|
109
|
+
const i = () => {
|
|
110
|
+
this._components.forEach((n) => n._syncRoutes());
|
|
111
|
+
};
|
|
112
|
+
p(this._vtMode) ? _(i) : i(), this._afterGuards.forEach((n) => n(e, t)), this._changeHandlers.forEach((n) => n(e, t));
|
|
113
|
+
}
|
|
114
|
+
async _navigate(e, t) {
|
|
115
|
+
const i = this._buildLocation(e), n = this._current;
|
|
116
|
+
for (const s of this._beforeGuards) {
|
|
117
|
+
const a = await new Promise((c) => {
|
|
118
|
+
s(i, n, c);
|
|
119
|
+
});
|
|
120
|
+
if (a === !1) return;
|
|
121
|
+
if (typeof a == "string") return this._navigate(a, t);
|
|
122
|
+
}
|
|
123
|
+
if (typeof window < "u") {
|
|
124
|
+
const s = this._mode === "hash" ? `#${e}` : this._base + e;
|
|
125
|
+
t ? window.history.replaceState({ path: e }, "", s) : window.history.pushState({ path: e }, "", s);
|
|
126
|
+
}
|
|
127
|
+
this._notify();
|
|
128
|
+
}
|
|
129
|
+
push(e) {
|
|
130
|
+
return this._navigate(e, !1);
|
|
131
|
+
}
|
|
132
|
+
replace(e) {
|
|
133
|
+
return this._navigate(e, !0);
|
|
134
|
+
}
|
|
135
|
+
back() {
|
|
136
|
+
typeof window < "u" && window.history.back();
|
|
137
|
+
}
|
|
138
|
+
forward() {
|
|
139
|
+
typeof window < "u" && window.history.forward();
|
|
140
|
+
}
|
|
141
|
+
go(e) {
|
|
142
|
+
typeof window < "u" && window.history.go(e);
|
|
143
|
+
}
|
|
144
|
+
destroy() {
|
|
145
|
+
this._disableMpa(), this._components.clear();
|
|
146
|
+
}
|
|
147
|
+
beforeEach(e) {
|
|
148
|
+
return this._beforeGuards.push(e), () => {
|
|
149
|
+
const t = this._beforeGuards.indexOf(e);
|
|
150
|
+
t !== -1 && this._beforeGuards.splice(t, 1);
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
afterEach(e) {
|
|
154
|
+
return this._afterGuards.push(e), () => {
|
|
155
|
+
const t = this._afterGuards.indexOf(e);
|
|
156
|
+
t !== -1 && this._afterGuards.splice(t, 1);
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
onRouteChange(e) {
|
|
160
|
+
return this._changeHandlers.push(e), () => {
|
|
161
|
+
const t = this._changeHandlers.indexOf(e);
|
|
162
|
+
t !== -1 && this._changeHandlers.splice(t, 1);
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
onPageSwap(e) {
|
|
166
|
+
return this._pageSwapHandlers.push(e), () => {
|
|
167
|
+
const t = this._pageSwapHandlers.indexOf(e);
|
|
168
|
+
t !== -1 && this._pageSwapHandlers.splice(t, 1);
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
onPageReveal(e) {
|
|
172
|
+
return this._pageRevealHandlers.push(e), () => {
|
|
173
|
+
const t = this._pageRevealHandlers.indexOf(e);
|
|
174
|
+
t !== -1 && this._pageRevealHandlers.splice(t, 1);
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
function y(e) {
|
|
179
|
+
o?.destroy();
|
|
180
|
+
const t = new g(e);
|
|
181
|
+
return o = t, t;
|
|
182
|
+
}
|
|
183
|
+
function S() {
|
|
184
|
+
return o;
|
|
185
|
+
}
|
|
186
|
+
function P() {
|
|
187
|
+
return h(), () => d();
|
|
188
|
+
}
|
|
189
|
+
export {
|
|
190
|
+
g as RouterCore,
|
|
191
|
+
b as clearSSGPath,
|
|
192
|
+
y as createRouter,
|
|
193
|
+
P as enableMpaViewTransitions,
|
|
194
|
+
m as getSSGPath,
|
|
195
|
+
v as setSSGPath,
|
|
196
|
+
S as useRouter
|
|
197
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface SSGPage {
|
|
2
|
+
/** URL path this page was rendered for, e.g. "/about". */
|
|
3
|
+
path: string;
|
|
4
|
+
/** Serialized HTML string with Declarative Shadow DOM. */
|
|
5
|
+
html: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Render a single router element for the given URL path.
|
|
9
|
+
*
|
|
10
|
+
* Sets the SSG path context so that each `r-route` child resolves its
|
|
11
|
+
* `hidden` attribute during serialization via `_preSerialize()`.
|
|
12
|
+
*
|
|
13
|
+
* const html = renderStaticPage(createApp(), '/about');
|
|
14
|
+
*/
|
|
15
|
+
export declare function renderStaticPage(element: HTMLElement, path: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Render one HTML page per route and return all results.
|
|
18
|
+
*
|
|
19
|
+
* `factory` is called once per route — it must return a freshly constructed
|
|
20
|
+
* router element tree (r-router + r-route children) each time, because each
|
|
21
|
+
* render mutates the element's `hidden` attributes.
|
|
22
|
+
*
|
|
23
|
+
* Paths are read from the active RouterCore's `getStaticPaths()` when omitted.
|
|
24
|
+
* Pass `options.paths` to override or to provide paths when no RouterCore is set.
|
|
25
|
+
*
|
|
26
|
+
* const router = createRouter({
|
|
27
|
+
* routes: [
|
|
28
|
+
* { path: '/', exact: true },
|
|
29
|
+
* { path: '/about' },
|
|
30
|
+
* { path: '/contact' },
|
|
31
|
+
* ],
|
|
32
|
+
* });
|
|
33
|
+
*
|
|
34
|
+
* const pages = generateStaticPages(() => {
|
|
35
|
+
* const app = new Router();
|
|
36
|
+
* [['/', homeContent], ['/about', aboutContent], ['/contact', contactContent]]
|
|
37
|
+
* .forEach(([path, content]) => {
|
|
38
|
+
* const route = new Route();
|
|
39
|
+
* route.setAttribute('path', path);
|
|
40
|
+
* route.appendChild(content);
|
|
41
|
+
* app.appendChild(route);
|
|
42
|
+
* });
|
|
43
|
+
* return app;
|
|
44
|
+
* });
|
|
45
|
+
* // pages = [{ path: '/', html: '...' }, { path: '/about', html: '...' }, ...]
|
|
46
|
+
*/
|
|
47
|
+
export declare function generateStaticPages(factory: () => HTMLElement, options?: {
|
|
48
|
+
paths?: string[];
|
|
49
|
+
}): SSGPage[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified registration that handles both browser (customElements.define) and
|
|
3
|
+
* SSR (internal registry) environments. Replace all bare customElements.define
|
|
4
|
+
* calls with this so new components are automatically available to renderToStream.
|
|
5
|
+
*/
|
|
6
|
+
export declare function defineSSR(tagName: string, constructor: new () => HTMLElement): void;
|
|
7
|
+
export declare function getSSRConstructor(tagName: string): (new () => HTMLElement) | undefined;
|
|
8
|
+
export declare function getSSRRegistry(): ReadonlyMap<string, new () => HTMLElement>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Streaming SSR renderer. Accepts an HTML string containing RanUI custom elements
|
|
3
|
+
* and yields HTML chunks with Declarative Shadow DOM (DSD) inlined.
|
|
4
|
+
*
|
|
5
|
+
* Static HTML is yielded immediately; custom elements are instantiated via the
|
|
6
|
+
* SSR registry and serialized before yielding.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { renderToStream } from 'ranui/ssr-stream';
|
|
11
|
+
*
|
|
12
|
+
* const stream = renderToStream(`
|
|
13
|
+
* <r-button type="primary">Submit</r-button>
|
|
14
|
+
* <r-progress percent="65"></r-progress>
|
|
15
|
+
* `);
|
|
16
|
+
* for await (const chunk of stream) res.write(chunk);
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function renderToStream(html: string): AsyncGenerator<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Non-streaming convenience wrapper. Collects all chunks and returns a single string.
|
|
22
|
+
*/
|
|
23
|
+
export declare function renderHTMLToString(html: string): Promise<string>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const HTMLElementSSR: () => {
|
|
2
|
+
new (): HTMLElement;
|
|
3
|
+
prototype: HTMLElement;
|
|
4
|
+
};
|
|
5
|
+
export declare const RanElement: {
|
|
6
|
+
new (): HTMLElement;
|
|
7
|
+
prototype: HTMLElement;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Rendering utility for RanUI components in SSR environments.
|
|
11
|
+
* Accepts a component instance and returns its HTML string with Declarative Shadow DOM.
|
|
12
|
+
*/
|
|
13
|
+
export declare const renderToString: (component: any) => string;
|
|
14
|
+
/**
|
|
15
|
+
* Convenience helper to render a tag with attributes and children manually.
|
|
16
|
+
*/
|
|
17
|
+
export declare const h: (tag: string, props?: Record<string, string>, ...children: any[]) => string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 将 CSS 字符串注入到指定的 Shadow DOM。
|
|
3
|
+
* - SSR 环境安全(自动跳过)
|
|
4
|
+
* - 幂等:同一 shadowRoot 不会重复注入
|
|
5
|
+
* - 优先使用 Constructable Stylesheets 提升性能
|
|
6
|
+
*/
|
|
7
|
+
export declare const adoptStyles: (shadowRoot: ShadowRoot, cssText: string) => void;
|
|
8
|
+
/**
|
|
9
|
+
* 注入通过组件 `sheet` 属性传入的动态样式。
|
|
10
|
+
* 幂等策略:同一 shadowRoot 内相同 cssText 只注入一次。
|
|
11
|
+
*/
|
|
12
|
+
export declare const adoptSheetText: (shadowRoot: ShadowRoot, cssText: string) => void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type RanThemeName = 'light' | 'dark' | 'system';
|
|
2
|
+
export type ThemeTarget = HTMLElement | Document;
|
|
3
|
+
export type ThemeTokenMap = Record<string, string | number | null | undefined>;
|
|
4
|
+
export declare const setTheme: (name: RanThemeName, target?: ThemeTarget) => void;
|
|
5
|
+
export declare const getTheme: (target?: ThemeTarget) => RanThemeName | "";
|
|
6
|
+
export declare const setThemeToken: (name: string, value: string | number, target?: HTMLElement) => void;
|
|
7
|
+
export declare const clearThemeToken: (name: string, target?: HTMLElement) => void;
|
|
8
|
+
export declare const setThemeTokens: (tokens: ThemeTokenMap, target?: HTMLElement) => void;
|
|
9
|
+
export declare const initTheme: (target?: ThemeTarget) => void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 缓动函数
|
|
3
|
+
* t: current time(当前时间)
|
|
4
|
+
* b: beginning value(初始值)
|
|
5
|
+
* c: change in value(变化量)
|
|
6
|
+
* d: duration(持续时间)
|
|
7
|
+
*
|
|
8
|
+
* 感谢张鑫旭大佬 https://github.com/zhangxinxu/Tween
|
|
9
|
+
*/
|
|
10
|
+
interface SpeedType {
|
|
11
|
+
easeIn: (...arr: number[]) => number;
|
|
12
|
+
easeOut: (...arr: number[]) => number;
|
|
13
|
+
}
|
|
14
|
+
export declare const quad: SpeedType;
|
|
15
|
+
export declare const cubic: SpeedType;
|
|
16
|
+
export declare const quart: SpeedType;
|
|
17
|
+
export declare const quint: SpeedType;
|
|
18
|
+
export declare const sine: SpeedType;
|
|
19
|
+
export declare const expo: SpeedType;
|
|
20
|
+
export declare const circ: SpeedType;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const vod: {
|
|
2
|
+
FD: {
|
|
3
|
+
label: string;
|
|
4
|
+
};
|
|
5
|
+
LD: {
|
|
6
|
+
bandWidth: {
|
|
7
|
+
h264: number;
|
|
8
|
+
h265: number;
|
|
9
|
+
};
|
|
10
|
+
label: string;
|
|
11
|
+
};
|
|
12
|
+
SD: {
|
|
13
|
+
bandWidth: {
|
|
14
|
+
h264: number;
|
|
15
|
+
h265: number;
|
|
16
|
+
};
|
|
17
|
+
label: string;
|
|
18
|
+
};
|
|
19
|
+
HD: {
|
|
20
|
+
bandWidth: {
|
|
21
|
+
h264: number;
|
|
22
|
+
h265: number;
|
|
23
|
+
};
|
|
24
|
+
label: string;
|
|
25
|
+
};
|
|
26
|
+
'2K': {
|
|
27
|
+
bandWidth: {
|
|
28
|
+
h264: number;
|
|
29
|
+
h265: number;
|
|
30
|
+
};
|
|
31
|
+
label: string;
|
|
32
|
+
};
|
|
33
|
+
'4K': {
|
|
34
|
+
bandWidth: {
|
|
35
|
+
h264: number;
|
|
36
|
+
h265: number;
|
|
37
|
+
};
|
|
38
|
+
label: string;
|
|
39
|
+
};
|
|
40
|
+
};
|