@moneko/react 0.0.7 → 0.0.9
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/lib/entry.js +1 -1
- package/lib/entry.js.map +1 -1
- package/package.json +1 -1
- package/lib/merge.d.ts +0 -10
- package/lib/merge.js +0 -2
- package/lib/merge.js.map +0 -1
- package/lib/normalize.css +0 -208
package/lib/entry.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";import
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import"react";import o from"@app";import t from"@app/fallback";import e from"@app/routes";import{createRoot as m}from"react-dom/client";import{RouterProvider as a,createBrowserRouter as n,createHashRouter as p}from"react-router-dom";export default function(i={}){let{container:c,basename:u=o.base,language:d,...f}=i,l="hash"===o.routerMode?p:n,s=c?.querySelector("#root")||document.getElementById("root"),w=m(s);return"micro"===o.type&&(window.mainApp={...f,container:s}),w.render(r(()=>r(a,{router:l(e,{basename:u,window:window}),fallbackElement:t&&r(t,{})}),{})),w.unmount};
|
|
2
2
|
//# sourceMappingURL=entry.js.map
|
package/lib/entry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/entry.tsx"],"sourcesContent":["import React
|
|
1
|
+
{"version":3,"sources":["../src/entry.tsx"],"sourcesContent":["import React from 'react';\nimport app from '@app';\nimport Fallback from '@app/fallback';\nimport routes from '@app/routes';\nimport { createRoot } from 'react-dom/client';\nimport { RouterProvider, createBrowserRouter, createHashRouter } from 'react-router-dom';\n\ntype RenderAppProps = {\n container?: HTMLElement;\n basename?: string;\n fallback?: React.ReactElement;\n language?: string;\n};\n\nfunction renderApp(props: RenderAppProps = {}) {\n const { container, basename = app.base, language, ...args } = props;\n const createRouter = app.routerMode === 'hash' ? createHashRouter : createBrowserRouter;\n const _container = container?.querySelector('#root') || document.getElementById('root');\n const instance = createRoot(_container as HTMLElement);\n\n if (app.type === 'micro') {\n window.mainApp = {\n ...args,\n container: _container as HTMLElement,\n };\n }\n const App = () => {\n return (\n <RouterProvider\n router={createRouter(routes, {\n basename: basename,\n window: window,\n })}\n fallbackElement={Fallback && <Fallback />}\n />\n );\n };\n\n instance.render(<App />);\n return instance.unmount;\n}\n\nexport default renderApp;\n"],"names":["app","Fallback","routes","createRoot","RouterProvider","createBrowserRouter","createHashRouter","props","container","basename","base","language","args","createRouter","routerMode","_container","querySelector","document","getElementById","instance","type","window","mainApp","render","router","fallbackElement","unmount"],"mappings":"uCAAA,OAAkB,OAAQ,AAC1B,QAAOA,MAAS,MAAO,AACvB,QAAOC,MAAc,eAAgB,AACrC,QAAOC,MAAY,aAAc,AACjC,QAASC,cAAAA,CAAU,KAAQ,kBAAmB,AAC9C,QAASC,kBAAAA,CAAc,CAAEC,uBAAAA,CAAmB,CAAEC,oBAAAA,CAAgB,KAAQ,kBAAmB,AAqCzF,gBA5BA,SAAmBC,EAAwB,CAAC,CAAC,EAC3C,GAAM,CAAEC,UAAAA,CAAS,CAAEC,SAAAA,EAAWT,EAAIU,IAAI,CAAEC,SAAAA,CAAQ,CAAE,GAAGC,EAAM,CAAGL,EACxDM,EAAeb,AAAmB,SAAnBA,EAAIc,WAAwBR,EAAmBD,EAC9DU,EAAaP,GAAWQ,cAAc,UAAYC,SAASC,eAAe,QAC1EC,EAAWhB,EAAWY,SAEX,UAAbf,EAAIoB,MACNC,CAAAA,OAAOC,QAAU,CACf,GAAGV,CAAI,CACPJ,UAAWO,CACb,CAAA,EAcFI,EAASI,OAAO,EAZJ,IAER,EAACnB,GACCoB,OAAQX,EAAaX,EAAQ,CAC3BO,SAAUA,EACVY,OAAQA,MACV,GACAI,gBAAiBxB,GAAY,EAACA,aAM7BkB,EAASO,OAClB,CAEyB"}
|
package/package.json
CHANGED
package/lib/merge.d.ts
DELETED
package/lib/merge.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createElement as e,isValidElement as r}from"react";export default function t(n,l){if(!n.length)return;let i=[];return n.forEach(e=>{let r=i.findIndex(r=>r[l]==e[l]);if(r>-1){let n=[...i[r].children||[],...e.children||[]];i[r]=Object.assign(e,i[r],i[r].meta&&{meta:{...i[r].meta,...e.meta}}),n.length&&(i[r].children=t(n,l))}else i.push(Object.assign(e,Array.isArray(e.children)&&{children:t(e.children,l)}))}),function t(n){return n.map(n=>{let l=Object.assign({key:n.path},n);return l.element&&!r(l.element)&&(l.element=e(l.element,l.meta)),Array.isArray(l.children)&&(l.children=t(l.children)),l})}(i)};
|
|
2
|
-
//# sourceMappingURL=merge.js.map
|
package/lib/merge.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/merge.ts"],"sourcesContent":["import { createElement, isValidElement } from 'react';\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype Prefix = { children?: Prefix[]; meta?: object; element?: any; path: string };\n\nfunction prefix<T extends Prefix>(list: T[]) {\n return list.map((r) => {\n const _ = Object.assign({ key: r.path }, r);\n\n if (_.element && !isValidElement(_.element)) {\n _.element = createElement(_.element, _.meta);\n }\n if (Array.isArray(_.children)) {\n _.children = prefix(_.children);\n }\n return _;\n });\n}\nfunction merge<T extends Prefix>(route: T[], key: keyof T) {\n if (!route.length) return void 0;\n const arr: T[] = [];\n\n route.forEach((e) => {\n const idx = arr.findIndex((i) => i[key] == e[key]);\n\n if (idx > -1) {\n const ctree: T[] = [...(arr[idx].children || []), ...(e.children || [])] as T[];\n\n arr[idx] = Object.assign(\n e,\n arr[idx],\n arr[idx].meta && {\n meta: {\n ...arr[idx].meta,\n ...e.meta,\n },\n },\n );\n if (ctree.length) {\n arr[idx].children = merge(ctree, key);\n }\n } else {\n arr.push(\n Object.assign(\n e,\n Array.isArray(e.children) && {\n children: merge(e.children as T[], key),\n },\n ),\n );\n }\n });\n\n return prefix(arr);\n}\n\nexport default merge;\n"],"names":["createElement","isValidElement","merge","route","key","length","arr","forEach","e","idx","findIndex","i","ctree","children","Object","assign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AChB,CAEqB"}
|
package/lib/normalize.css
DELETED
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
html,
|
|
2
|
-
body {
|
|
3
|
-
margin: 0;
|
|
4
|
-
padding: 0;
|
|
5
|
-
line-height: 1.8;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
input,
|
|
9
|
-
textarea {
|
|
10
|
-
caret-color: inherit;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
h1 {
|
|
14
|
-
margin: 0.67em 0;
|
|
15
|
-
font-size: 2em;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
hr {
|
|
19
|
-
overflow: visible;
|
|
20
|
-
block-size: 0;
|
|
21
|
-
box-sizing: content-box;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
pre {
|
|
25
|
-
font-size: 1em;
|
|
26
|
-
font-family: monospace;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
a {
|
|
30
|
-
text-decoration: none;
|
|
31
|
-
background-color: transparent;
|
|
32
|
-
cursor: pointer;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
abbr[title] {
|
|
36
|
-
border-block-end: none;
|
|
37
|
-
text-decoration: underline;
|
|
38
|
-
text-decoration: underline dotted;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
b,
|
|
42
|
-
strong {
|
|
43
|
-
font-weight: bolder;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
code,
|
|
47
|
-
kbd,
|
|
48
|
-
samp {
|
|
49
|
-
font-size: 1em;
|
|
50
|
-
font-family: monospace;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
small {
|
|
54
|
-
font-size: 80%;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
sub,
|
|
58
|
-
sup {
|
|
59
|
-
position: relative;
|
|
60
|
-
font-size: 75%;
|
|
61
|
-
line-height: 0;
|
|
62
|
-
vertical-align: baseline;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
sub {
|
|
66
|
-
inset-block-end: -0.25em;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
sup {
|
|
70
|
-
inset-block-start: -0.5em;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
img {
|
|
74
|
-
border-style: none;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
img,
|
|
78
|
-
button {
|
|
79
|
-
outline: 1px solid transparent;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
button,
|
|
83
|
-
input,
|
|
84
|
-
optgroup,
|
|
85
|
-
select,
|
|
86
|
-
textarea {
|
|
87
|
-
margin: 0;
|
|
88
|
-
font-size: 100%;
|
|
89
|
-
font-family: inherit;
|
|
90
|
-
line-height: 1.15;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
button,
|
|
94
|
-
input {
|
|
95
|
-
overflow: visible;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
button,
|
|
99
|
-
select {
|
|
100
|
-
text-transform: none;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
button,
|
|
104
|
-
[type='button'],
|
|
105
|
-
[type='reset'],
|
|
106
|
-
[type='submit'] {
|
|
107
|
-
appearance: button;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
button::-moz-focus-inner,
|
|
111
|
-
[type='button']::-moz-focus-inner,
|
|
112
|
-
[type='reset']::-moz-focus-inner,
|
|
113
|
-
[type='submit']::-moz-focus-inner {
|
|
114
|
-
border-style: none;
|
|
115
|
-
padding: 0;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
button:-moz-focusring,
|
|
119
|
-
[type='button']:-moz-focusring,
|
|
120
|
-
[type='reset']:-moz-focusring,
|
|
121
|
-
[type='submit']:-moz-focusring {
|
|
122
|
-
outline: 1px dotted var(--primary-outline);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
fieldset {
|
|
126
|
-
padding: 0.35em 0.75em 0.625em;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
legend {
|
|
130
|
-
display: table;
|
|
131
|
-
padding: 0;
|
|
132
|
-
max-inline-size: 100%;
|
|
133
|
-
white-space: normal;
|
|
134
|
-
color: inherit;
|
|
135
|
-
box-sizing: border-box;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
progress {
|
|
139
|
-
vertical-align: baseline;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
textarea {
|
|
143
|
-
overflow: auto;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
details {
|
|
147
|
-
display: block;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
summary {
|
|
151
|
-
display: list-item;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
template,
|
|
155
|
-
[hidden] {
|
|
156
|
-
display: none;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
[type='checkbox'],
|
|
160
|
-
[type='radio'] {
|
|
161
|
-
box-sizing: border-box;
|
|
162
|
-
padding: 0;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
[type='number']::-webkit-inner-spin-button,
|
|
166
|
-
[type='number']::-webkit-outer-spin-button {
|
|
167
|
-
block-size: auto;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
[type='search'] {
|
|
171
|
-
appearance: textfield;
|
|
172
|
-
outline-offset: -2px;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
[type='search']::-webkit-search-decoration {
|
|
176
|
-
appearance: none;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
::-webkit-file-upload-button {
|
|
180
|
-
appearance: button;
|
|
181
|
-
font: inherit;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
::-webkit-scrollbar {
|
|
185
|
-
inline-size: 5px;
|
|
186
|
-
block-size: 5px;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
::-webkit-scrollbar-track,
|
|
190
|
-
::-webkit-scrollbar-thumb {
|
|
191
|
-
background-color: transparent;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
:hover::-webkit-scrollbar-thumb {
|
|
195
|
-
background-color: var(--primary-selection);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
::-webkit-scrollbar-thumb:hover {
|
|
199
|
-
background-color: var(--primary-hover);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
::-webkit-scrollbar-thumb:active {
|
|
203
|
-
background-color: var(--primary-active);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
::-webkit-scrollbar-button {
|
|
207
|
-
display: none;
|
|
208
|
-
}
|