olova 2.0.16 → 2.0.18

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.
@@ -0,0 +1,350 @@
1
+ import {
2
+ __commonJS,
3
+ __toESM,
4
+ require_react
5
+ } from "./chunk-TFRUFD5A.js";
6
+
7
+ // node_modules/react/cjs/react-jsx-runtime.production.js
8
+ var require_react_jsx_runtime_production = __commonJS({
9
+ "node_modules/react/cjs/react-jsx-runtime.production.js"(exports) {
10
+ "use strict";
11
+ var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element");
12
+ var REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment");
13
+ function jsxProd(type, config, maybeKey) {
14
+ var key = null;
15
+ void 0 !== maybeKey && (key = "" + maybeKey);
16
+ void 0 !== config.key && (key = "" + config.key);
17
+ if ("key" in config) {
18
+ maybeKey = {};
19
+ for (var propName in config)
20
+ "key" !== propName && (maybeKey[propName] = config[propName]);
21
+ } else maybeKey = config;
22
+ config = maybeKey.ref;
23
+ return {
24
+ $$typeof: REACT_ELEMENT_TYPE,
25
+ type,
26
+ key,
27
+ ref: void 0 !== config ? config : null,
28
+ props: maybeKey
29
+ };
30
+ }
31
+ exports.Fragment = REACT_FRAGMENT_TYPE;
32
+ exports.jsx = jsxProd;
33
+ exports.jsxs = jsxProd;
34
+ }
35
+ });
36
+
37
+ // node_modules/react/cjs/react-jsx-runtime.development.js
38
+ var require_react_jsx_runtime_development = __commonJS({
39
+ "node_modules/react/cjs/react-jsx-runtime.development.js"(exports) {
40
+ "use strict";
41
+ "production" !== process.env.NODE_ENV && (function() {
42
+ function getComponentNameFromType(type) {
43
+ if (null == type) return null;
44
+ if ("function" === typeof type)
45
+ return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
46
+ if ("string" === typeof type) return type;
47
+ switch (type) {
48
+ case REACT_FRAGMENT_TYPE:
49
+ return "Fragment";
50
+ case REACT_PROFILER_TYPE:
51
+ return "Profiler";
52
+ case REACT_STRICT_MODE_TYPE:
53
+ return "StrictMode";
54
+ case REACT_SUSPENSE_TYPE:
55
+ return "Suspense";
56
+ case REACT_SUSPENSE_LIST_TYPE:
57
+ return "SuspenseList";
58
+ case REACT_ACTIVITY_TYPE:
59
+ return "Activity";
60
+ }
61
+ if ("object" === typeof type)
62
+ switch ("number" === typeof type.tag && console.error(
63
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
64
+ ), type.$$typeof) {
65
+ case REACT_PORTAL_TYPE:
66
+ return "Portal";
67
+ case REACT_CONTEXT_TYPE:
68
+ return type.displayName || "Context";
69
+ case REACT_CONSUMER_TYPE:
70
+ return (type._context.displayName || "Context") + ".Consumer";
71
+ case REACT_FORWARD_REF_TYPE:
72
+ var innerType = type.render;
73
+ type = type.displayName;
74
+ type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
75
+ return type;
76
+ case REACT_MEMO_TYPE:
77
+ return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
78
+ case REACT_LAZY_TYPE:
79
+ innerType = type._payload;
80
+ type = type._init;
81
+ try {
82
+ return getComponentNameFromType(type(innerType));
83
+ } catch (x) {
84
+ }
85
+ }
86
+ return null;
87
+ }
88
+ function testStringCoercion(value) {
89
+ return "" + value;
90
+ }
91
+ function checkKeyStringCoercion(value) {
92
+ try {
93
+ testStringCoercion(value);
94
+ var JSCompiler_inline_result = false;
95
+ } catch (e) {
96
+ JSCompiler_inline_result = true;
97
+ }
98
+ if (JSCompiler_inline_result) {
99
+ JSCompiler_inline_result = console;
100
+ var JSCompiler_temp_const = JSCompiler_inline_result.error;
101
+ var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
102
+ JSCompiler_temp_const.call(
103
+ JSCompiler_inline_result,
104
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
105
+ JSCompiler_inline_result$jscomp$0
106
+ );
107
+ return testStringCoercion(value);
108
+ }
109
+ }
110
+ function getTaskName(type) {
111
+ if (type === REACT_FRAGMENT_TYPE) return "<>";
112
+ if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE)
113
+ return "<...>";
114
+ try {
115
+ var name = getComponentNameFromType(type);
116
+ return name ? "<" + name + ">" : "<...>";
117
+ } catch (x) {
118
+ return "<...>";
119
+ }
120
+ }
121
+ function getOwner() {
122
+ var dispatcher = ReactSharedInternals.A;
123
+ return null === dispatcher ? null : dispatcher.getOwner();
124
+ }
125
+ function UnknownOwner() {
126
+ return Error("react-stack-top-frame");
127
+ }
128
+ function hasValidKey(config) {
129
+ if (hasOwnProperty.call(config, "key")) {
130
+ var getter = Object.getOwnPropertyDescriptor(config, "key").get;
131
+ if (getter && getter.isReactWarning) return false;
132
+ }
133
+ return void 0 !== config.key;
134
+ }
135
+ function defineKeyPropWarningGetter(props, displayName) {
136
+ function warnAboutAccessingKey() {
137
+ specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error(
138
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
139
+ displayName
140
+ ));
141
+ }
142
+ warnAboutAccessingKey.isReactWarning = true;
143
+ Object.defineProperty(props, "key", {
144
+ get: warnAboutAccessingKey,
145
+ configurable: true
146
+ });
147
+ }
148
+ function elementRefGetterWithDeprecationWarning() {
149
+ var componentName = getComponentNameFromType(this.type);
150
+ didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error(
151
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
152
+ ));
153
+ componentName = this.props.ref;
154
+ return void 0 !== componentName ? componentName : null;
155
+ }
156
+ function ReactElement(type, key, props, owner, debugStack, debugTask) {
157
+ var refProp = props.ref;
158
+ type = {
159
+ $$typeof: REACT_ELEMENT_TYPE,
160
+ type,
161
+ key,
162
+ props,
163
+ _owner: owner
164
+ };
165
+ null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", {
166
+ enumerable: false,
167
+ get: elementRefGetterWithDeprecationWarning
168
+ }) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
169
+ type._store = {};
170
+ Object.defineProperty(type._store, "validated", {
171
+ configurable: false,
172
+ enumerable: false,
173
+ writable: true,
174
+ value: 0
175
+ });
176
+ Object.defineProperty(type, "_debugInfo", {
177
+ configurable: false,
178
+ enumerable: false,
179
+ writable: true,
180
+ value: null
181
+ });
182
+ Object.defineProperty(type, "_debugStack", {
183
+ configurable: false,
184
+ enumerable: false,
185
+ writable: true,
186
+ value: debugStack
187
+ });
188
+ Object.defineProperty(type, "_debugTask", {
189
+ configurable: false,
190
+ enumerable: false,
191
+ writable: true,
192
+ value: debugTask
193
+ });
194
+ Object.freeze && (Object.freeze(type.props), Object.freeze(type));
195
+ return type;
196
+ }
197
+ function jsxDEVImpl(type, config, maybeKey, isStaticChildren, debugStack, debugTask) {
198
+ var children = config.children;
199
+ if (void 0 !== children)
200
+ if (isStaticChildren)
201
+ if (isArrayImpl(children)) {
202
+ for (isStaticChildren = 0; isStaticChildren < children.length; isStaticChildren++)
203
+ validateChildKeys(children[isStaticChildren]);
204
+ Object.freeze && Object.freeze(children);
205
+ } else
206
+ console.error(
207
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
208
+ );
209
+ else validateChildKeys(children);
210
+ if (hasOwnProperty.call(config, "key")) {
211
+ children = getComponentNameFromType(type);
212
+ var keys = Object.keys(config).filter(function(k) {
213
+ return "key" !== k;
214
+ });
215
+ isStaticChildren = 0 < keys.length ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
216
+ didWarnAboutKeySpread[children + isStaticChildren] || (keys = 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}", console.error(
217
+ 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
218
+ isStaticChildren,
219
+ children,
220
+ keys,
221
+ children
222
+ ), didWarnAboutKeySpread[children + isStaticChildren] = true);
223
+ }
224
+ children = null;
225
+ void 0 !== maybeKey && (checkKeyStringCoercion(maybeKey), children = "" + maybeKey);
226
+ hasValidKey(config) && (checkKeyStringCoercion(config.key), children = "" + config.key);
227
+ if ("key" in config) {
228
+ maybeKey = {};
229
+ for (var propName in config)
230
+ "key" !== propName && (maybeKey[propName] = config[propName]);
231
+ } else maybeKey = config;
232
+ children && defineKeyPropWarningGetter(
233
+ maybeKey,
234
+ "function" === typeof type ? type.displayName || type.name || "Unknown" : type
235
+ );
236
+ return ReactElement(
237
+ type,
238
+ children,
239
+ maybeKey,
240
+ getOwner(),
241
+ debugStack,
242
+ debugTask
243
+ );
244
+ }
245
+ function validateChildKeys(node) {
246
+ isValidElement(node) ? node._store && (node._store.validated = 1) : "object" === typeof node && null !== node && node.$$typeof === REACT_LAZY_TYPE && ("fulfilled" === node._payload.status ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
247
+ }
248
+ function isValidElement(object) {
249
+ return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
250
+ }
251
+ var React = require_react(), REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = /* @__PURE__ */ Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo"), REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = /* @__PURE__ */ Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = /* @__PURE__ */ Symbol.for("react.client.reference"), ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
252
+ return null;
253
+ };
254
+ React = {
255
+ react_stack_bottom_frame: function(callStackForError) {
256
+ return callStackForError();
257
+ }
258
+ };
259
+ var specialPropKeyWarningShown;
260
+ var didWarnAboutElementRef = {};
261
+ var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(
262
+ React,
263
+ UnknownOwner
264
+ )();
265
+ var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
266
+ var didWarnAboutKeySpread = {};
267
+ exports.Fragment = REACT_FRAGMENT_TYPE;
268
+ exports.jsx = function(type, config, maybeKey) {
269
+ var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
270
+ return jsxDEVImpl(
271
+ type,
272
+ config,
273
+ maybeKey,
274
+ false,
275
+ trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
276
+ trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
277
+ );
278
+ };
279
+ exports.jsxs = function(type, config, maybeKey) {
280
+ var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
281
+ return jsxDEVImpl(
282
+ type,
283
+ config,
284
+ maybeKey,
285
+ true,
286
+ trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
287
+ trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
288
+ );
289
+ };
290
+ })();
291
+ }
292
+ });
293
+
294
+ // node_modules/react/jsx-runtime.js
295
+ var require_jsx_runtime = __commonJS({
296
+ "node_modules/react/jsx-runtime.js"(exports, module) {
297
+ "use strict";
298
+ if (process.env.NODE_ENV === "production") {
299
+ module.exports = require_react_jsx_runtime_production();
300
+ } else {
301
+ module.exports = require_react_jsx_runtime_development();
302
+ }
303
+ }
304
+ });
305
+
306
+ // Link.tsx
307
+ var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
308
+ function Link({ href, children, ...props }) {
309
+ const handleClick = (e) => {
310
+ if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
311
+ if (href.startsWith("http") || href.startsWith("//")) return;
312
+ e.preventDefault();
313
+ const currentUrl = window.location.pathname + window.location.search;
314
+ const targetUrl = href.startsWith("/") ? href : "/" + href;
315
+ if (currentUrl === targetUrl) return;
316
+ window.history.pushState({}, "", href);
317
+ window.dispatchEvent(new Event("pushstate"));
318
+ };
319
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href, onClick: handleClick, ...props, children });
320
+ }
321
+ var Link_default = Link;
322
+
323
+ export {
324
+ Link,
325
+ Link_default
326
+ };
327
+ /*! Bundled license information:
328
+
329
+ react/cjs/react-jsx-runtime.production.js:
330
+ (**
331
+ * @license React
332
+ * react-jsx-runtime.production.js
333
+ *
334
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
335
+ *
336
+ * This source code is licensed under the MIT license found in the
337
+ * LICENSE file in the root directory of this source tree.
338
+ *)
339
+
340
+ react/cjs/react-jsx-runtime.development.js:
341
+ (**
342
+ * @license React
343
+ * react-jsx-runtime.development.js
344
+ *
345
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
346
+ *
347
+ * This source code is licensed under the MIT license found in the
348
+ * LICENSE file in the root directory of this source tree.
349
+ *)
350
+ */
@@ -0,0 +1,23 @@
1
+ import {
2
+ RouterContext
3
+ } from "./chunk-7BXNTMPM.js";
4
+ import {
5
+ __toESM,
6
+ require_react
7
+ } from "./chunk-TFRUFD5A.js";
8
+
9
+ // useParams.ts
10
+ var import_react = __toESM(require_react(), 1);
11
+ function useParams() {
12
+ return (0, import_react.useContext)(RouterContext).params;
13
+ }
14
+ function usePath() {
15
+ return (0, import_react.useContext)(RouterContext).path;
16
+ }
17
+ var useParams_default = useParams;
18
+
19
+ export {
20
+ useParams,
21
+ usePath,
22
+ useParams_default
23
+ };
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ export { default as Link } from './Link.js';
3
+ export { ReadonlyURLSearchParams, default as useSearchParams } from './useSearchParams.js';
4
+ export { default as usePathname } from './usePathname.js';
5
+ export { default as useParams, usePath } from './useParams.js';
6
+ export { Metadata, Router, loadRoute, matchRoute } from './Router.js';
7
+
8
+ declare const RouterContext: React.Context<{
9
+ params: Record<string, string>;
10
+ path: string;
11
+ }>;
12
+
13
+ export { RouterContext };
package/dist/index.js ADDED
@@ -0,0 +1,33 @@
1
+ import {
2
+ Link
3
+ } from "./chunk-WNRULQF5.js";
4
+ import {
5
+ Router,
6
+ loadRoute,
7
+ matchRoute
8
+ } from "./chunk-4CH3KNWP.js";
9
+ import {
10
+ useParams,
11
+ usePath
12
+ } from "./chunk-YVUSXRPM.js";
13
+ import {
14
+ RouterContext
15
+ } from "./chunk-7BXNTMPM.js";
16
+ import {
17
+ usePathname
18
+ } from "./chunk-RCRG2FBU.js";
19
+ import {
20
+ useSearchParams
21
+ } from "./chunk-K2URQPLW.js";
22
+ import "./chunk-TFRUFD5A.js";
23
+ export {
24
+ Link,
25
+ Router,
26
+ RouterContext,
27
+ loadRoute,
28
+ matchRoute,
29
+ useParams,
30
+ usePath,
31
+ usePathname,
32
+ useSearchParams
33
+ };
@@ -0,0 +1,4 @@
1
+ declare function useParams(): Record<string, string>;
2
+ declare function usePath(): string;
3
+
4
+ export { useParams as default, useParams, usePath };
@@ -0,0 +1,12 @@
1
+ import {
2
+ useParams,
3
+ useParams_default,
4
+ usePath
5
+ } from "./chunk-YVUSXRPM.js";
6
+ import "./chunk-7BXNTMPM.js";
7
+ import "./chunk-TFRUFD5A.js";
8
+ export {
9
+ useParams_default as default,
10
+ useParams,
11
+ usePath
12
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Returns the current pathname (without query string or hash)
3
+ * Similar to Next.js usePathname hook
4
+ */
5
+ declare function usePathname(): string;
6
+
7
+ export { usePathname as default, usePathname };
@@ -0,0 +1,9 @@
1
+ import {
2
+ usePathname,
3
+ usePathname_default
4
+ } from "./chunk-RCRG2FBU.js";
5
+ import "./chunk-TFRUFD5A.js";
6
+ export {
7
+ usePathname_default as default,
8
+ usePathname
9
+ };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * A read-only interface for URLSearchParams
3
+ * Similar to Next.js useSearchParams hook
4
+ */
5
+ interface ReadonlyURLSearchParams {
6
+ get(name: string): string | null;
7
+ getAll(name: string): string[];
8
+ has(name: string): boolean;
9
+ keys(): IterableIterator<string>;
10
+ values(): IterableIterator<string>;
11
+ entries(): IterableIterator<[string, string]>;
12
+ forEach(callback: (value: string, key: string, parent: URLSearchParams) => void): void;
13
+ toString(): string;
14
+ size: number;
15
+ }
16
+ /**
17
+ * Returns the current URL search parameters
18
+ * Similar to Next.js useSearchParams hook
19
+ *
20
+ * Example usage:
21
+ * const searchParams = useSearchParams();
22
+ * const query = searchParams.get('q'); // ?q=hello -> 'hello'
23
+ * const tags = searchParams.getAll('tag'); // ?tag=a&tag=b -> ['a', 'b']
24
+ */
25
+ declare function useSearchParams(): ReadonlyURLSearchParams;
26
+
27
+ export { type ReadonlyURLSearchParams, useSearchParams as default, useSearchParams };
@@ -0,0 +1,9 @@
1
+ import {
2
+ useSearchParams,
3
+ useSearchParams_default
4
+ } from "./chunk-K2URQPLW.js";
5
+ import "./chunk-TFRUFD5A.js";
6
+ export {
7
+ useSearchParams_default as default,
8
+ useSearchParams
9
+ };
package/package.json CHANGED
@@ -1,15 +1,46 @@
1
- {
2
- "name": "olova",
3
- "version": "2.0.16",
4
- "description": "A lightweight JavaScript framework for building reactive applications.",
5
- "main": "dist/olova.js",
6
- "keywords": [
7
- "javascript",
8
- "framework",
9
- "reactive",
10
- "olova",
11
- "olovajs"
12
- ],
13
- "author": "Nazmul Hossain",
14
- "license": "MIT"
15
- }
1
+
2
+ {
3
+ "name": "olova",
4
+ "version": "2.0.18",
5
+ "description": "Olova framework core",
6
+ "type": "module",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "exports": {
11
+ ".": {
12
+ "import": "./dist/index.js",
13
+ "types": "./dist/index.d.ts"
14
+ },
15
+ "./Link": {
16
+ "import": "./dist/Link.js",
17
+ "types": "./dist/Link.d.ts"
18
+ },
19
+ "./useSearchParams": {
20
+ "import": "./dist/useSearchParams.js",
21
+ "types": "./dist/useSearchParams.d.ts"
22
+ },
23
+ "./usePathname": {
24
+ "import": "./dist/usePathname.js",
25
+ "types": "./dist/usePathname.d.ts"
26
+ },
27
+ "./useParams": {
28
+ "import": "./dist/useParams.js",
29
+ "types": "./dist/useParams.d.ts"
30
+ },
31
+ "./Router": {
32
+ "import": "./dist/Router.js",
33
+ "types": "./dist/Router.d.ts"
34
+ }
35
+ },
36
+ "scripts": {
37
+ "build": "tsup index.ts Link.tsx useSearchParams.ts usePathname.ts useParams.ts Router.tsx --format esm --dts --clean --external olova/routes react react-dom",
38
+ "prepublishOnly": "npm run build"
39
+ },
40
+ "devDependencies": {
41
+ "tsup": "^8.0.0",
42
+ "typescript": "^5.0.0",
43
+ "@types/react": "^19.0.0",
44
+ "@types/react-dom": "^19.0.0"
45
+ }
46
+ }
@@ -1,18 +0,0 @@
1
- name: Publish to NPM
2
-
3
- on:
4
- push:
5
- branches: [ main ]
6
-
7
- jobs:
8
- publish:
9
- runs-on: ubuntu-latest
10
- steps:
11
- - uses: actions/checkout@v2
12
- - uses: actions/setup-node@v2
13
- with:
14
- node-version: '14'
15
- registry-url: 'https://registry.npmjs.org'
16
- - run: yarn publish
17
- env:
18
- NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
package/README.md DELETED
@@ -1 +0,0 @@
1
-
package/dist/olova.d.ts DELETED
@@ -1 +0,0 @@
1
- declare module "olova";
package/dist/olova.js DELETED
@@ -1 +0,0 @@
1
- const e=Symbol("BATCH_UPDATES"),t=Symbol("SIGNAL_TYPE");class n{constructor(){this.globalSubs=new Set,this.propSubs=new Map,this.weakPropSubs=new WeakMap,this.dependencies=new WeakMap,this.batchMode=!1,this.pendingDeps=new Set}subscribe(e,t){if(!t)return;this.dependencies.has(t)||this.dependencies.set(t,new Set);const n=this.dependencies.get(t);if(!n.has(e)){if(n.add(e),!e)return void this.globalSubs.add(t);const i="object"==typeof e?this.weakPropSubs:this.propSubs;i.has(e)||i.set(e,new Set),i.get(e).add(t)}}notify(e,t=new Set){if(this.batchMode)return this.pendingDeps.add(e),t;if(e){const n=this.propSubs.get(e);if(n&&this.notifyDependentSubs(n,e,t),"object"==typeof e){const n=this.weakPropSubs.get(e);n&&this.notifyDependentSubs(n,e,t)}}return this.notifyDependentSubs(this.globalSubs,e,t),t}startBatch(){this.batchMode=!0,this.pendingDeps.clear()}endBatch(){this.batchMode=!1;const e=new Set;for(const t of this.pendingDeps)this.notify(t,e);return this.pendingDeps.clear(),e}notifyDependentSubs(e,t,n){for(const i of e)if(!n.has(i)){const e=this.dependencies.get(i);t&&e&&!e.has(t)||(i(),n.add(i))}}cleanup(e){if(e){this.propSubs.delete(e);for(const[t,n]of this.dependencies)n.delete(e),0===n.size&&this.dependencies.delete(t)}}}class i{constructor(){this.updates=new Map,this.priorities=new Map,this.timeouts=new Map,this.debounceTime=16}add(e,t,n=0,i=!1){if(i)return this.timeouts.has(e)&&clearTimeout(this.timeouts.get(e)),void this.timeouts.set(e,setTimeout((()=>{this.addImmediate(e,t,n),this.timeouts.delete(e)}),this.debounceTime));this.addImmediate(e,t,n)}addImmediate(e,t,n){if(this.updates.has(e)){const i=this.updates.get(e),o=this.priorities.get(e)||0;"object"==typeof i&&"object"==typeof t&&(t={...i,...t}),n=Math.max(o,n)}this.updates.set(e,t),this.priorities.set(e,n)}process(e){0!==this.updates.size&&(this.timeouts.size>0?Promise.all(Array.from(this.timeouts.values()).map((e=>new Promise((t=>{const n=setInterval((()=>{this.timeouts.has(e)||(clearInterval(n),t())}),0)}))))).then((()=>this.processImmediate(e))):this.processImmediate(e))}processImmediate(e){const t=[...this.updates.entries()].sort(((e,t)=>(this.priorities.get(t[0])||0)-(this.priorities.get(e[0])||0)));e.startBatch();const n=new Set;for(const[i,o]of t)"function"==typeof o&&o(),e.notify(i,n);e.endBatch(),this.updates.clear(),this.priorities.clear()}clear(){this.timeouts.forEach((e=>clearTimeout(e))),this.timeouts.clear(),this.updates.clear(),this.priorities.clear()}}const o=(o,r={})=>{const{equals:s=Object.is,immediate:a=!0,batched:c=!1,debounce:l=!1}=r;let d=o;const u=new n,f=new i,h=e=>{const t=p();return t&&u.subscribe(e,t),e?d[e]:d};return h[e]=()=>(u.startBatch(),()=>{u.endBatch(),f.clear()}),h[t]=!0,[h,(e,t,n=0)=>{const i="function"==typeof e?e(t?d[t]:d):e;(t?!s(d[t],i):!s(d,i))&&(d=t?{...d,[t]:i}:i,c?(f.add(t,i,n,l),queueMicrotask((()=>{f.process(u)}))):u.notify(t))}]};function r(e,t={defer:!1}){let n=null,i=new Set,o=new Set;const r=()=>{n&&n(),o.forEach((e=>e())),o.clear(),i.clear(),h=r;try{n=e()||null}finally{h=null}};return t.defer||r(),r}function s(e){const t=p();if(!t)throw new Error("onCleanup must be called within a reactive context");if(!t.cleanupFns)return e;t.cleanupFns.add(e)}function a(e,t={}){const[n,i]=o(void 0,t);let s=!1,a=new Set;return r((()=>{a.clear();const o=e();s&&t.equals&&t.equals(n(),o)||(i(o),s=!0)})),n}function c(e,t={}){const{initialValue:n=null,cacheTime:i=5e3,retries:r=3,retryDelay:s=1e3,lazy:a=!1}=t,[c,l]=o(n),[d,u]=o(!1),[f,h]=o(null);let p=new Map,m=new Map,g=0;const y=e=>{e?(p.delete(e),m.has(e)&&(clearTimeout(m.get(e)),m.delete(e))):(p.clear(),m.forEach((e=>clearTimeout(e))),m.clear())},b=async t=>{const n=JSON.stringify(t);if(p.has(n))return p.get(n);u(!0),h(null),g=0;const o=async()=>{try{const o=await e(t);return l(o),p.set(n,o),i>0&&m.set(n,setTimeout((()=>y(n)),i)),o}catch(e){if(g<r)return g++,await new Promise((e=>setTimeout(e,s*g))),o();throw h(e),e}finally{u(!1)}};return o()};return a||b(),{data:c,loading:d,error:f,refetch:b,clearCache:y}}new Map;function l(e,n,...i){const o="http://www.w3.org/2000/svg",s=new Set(["svg","path","circle","rect","line","polygon","polyline","ellipse","g","text","tspan","defs","use","mask","clipPath"]);if("function"==typeof e)return e({...n,children:i});if(e===d){const e=document.createDocumentFragment();return i.flat().forEach((t=>{const n=w(t);n&&e.appendChild(n)})),e}if("string"!=typeof e)throw new Error(`Invalid element type: ${e}`);const a=s.has(e.toLowerCase())||n&&n.xmlns===o,c=a?document.createElementNS(o,e):document.createElement(e);if(n)for(const[e,i]of Object.entries(n))if("ref"===e)"function"==typeof i?i(c):i&&(i.current=c);else if(e.startsWith("on")){const t=e.slice(2).toLowerCase();c.addEventListener(t,i)}else if("style"===e)"string"==typeof i?c.style.cssText=i:Object.assign(c.style,i);else if("classList"===e){if(Array.isArray(i))c.classList.add(...i.filter(Boolean));else if("object"==typeof i)for(const[e,t]of Object.entries(i))t?c.classList.add(e):c.classList.remove(e)}else"class"===e||"className"===e?c.setAttribute("class",i):["key"].includes(e)||("function"==typeof i&&i[t]?r((()=>{a?c.setAttribute(e,i()):c[e]=i()})):a?!0===i?c.setAttribute(e,""):!1!==i&&null!=i&&c.setAttribute(e,i):c[e]=i);return i.flat().forEach((e=>{if(null==e)return;const t=w(e);t&&(a&&t instanceof SVGElement||t instanceof Node?c.appendChild(t):c.appendChild(document.createTextNode(String(t))))})),c}const d=Symbol("Fragment");function u(t,n,i={}){const{hydrate:r=!1,onError:s=console.error,suspense:a=!0,beforeMount:c,afterMount:l}=i;if(!r)for(;n.firstChild;)n.removeChild(n.firstChild);const[d]=o(null),u=d[e]();c?.();try{let e=t();if(a&&e instanceof Promise)return void e.then((e=>{f(e,n,r),l?.()})).catch(s);f(e,n,r),l?.()}catch(t){s(t)}finally{u()}return()=>{for(;n.firstChild;)n.removeChild(n.firstChild)}}function f(e,t,n){if(!e)return;const i=Array.isArray(e)?e.flat(1/0):[e],o=Array.from(t.childNodes);let r=0;if(i.filter(Boolean).forEach((e=>{"string"==typeof e||"number"==typeof e?n&&o[r]?.nodeType===Node.TEXT_NODE?o[r].textContent=String(e):t.appendChild(document.createTextNode(String(e))):e instanceof Node?n&&o[r]?e.isEqualNode(o[r])||t.replaceChild(e,o[r]):t.appendChild(e):Array.isArray(e)?f(e,t,n):e&&"object"==typeof e&&t.appendChild(document.createTextNode(JSON.stringify(e))),r++})),!n)for(;r<o.length;)t.removeChild(o[r]),r++}let h=null;const p=()=>h;function m(e){const t=Symbol("context");return new Map,{Provider:({value:e,children:n})=>{const i=g(t);return h=e,h=i,n},Context:t,defaultValue:e}}function g(e){return h||e.defaultValue}function y({fallback:e,children:t}){try{return t}catch(t){return e(t)}}function b(e){let t=null,n=null;return function(i){if(!t)throw n||(n=e().then((e=>{t=e.default||e}))),n;return l(t,i)}}function S(e=null){return{current:e}}"undefined"!=typeof window?(window.h=l,window.Fragment=d):"undefined"!=typeof global&&(global.h=l,global.Fragment=d);export{o as setSignal,r as setEffect,a as setMemo,c as setResource,m as setContext,g as useContext,l as h,d as Fragment,u as render,y as ErrorBoundary,b as lazy,s as onCleanup,S as setRef};export default{h:l,Fragment:d};const w=e=>{if(null==e||!1===e||!0===e)return null;const n=()=>{const e=Math.random().toString(36).slice(2,8),t=document.createComment(`start:${e}`),n=document.createComment(`end:${e}`),i=document.createDocumentFragment();return i.appendChild(t),i.appendChild(n),{fragment:i,startNode:t,endNode:n}};if("function"==typeof e){const{fragment:i,startNode:o,endNode:s}=n();let a=null,c=null;return r((()=>{let n=(e[t],e());if(null!=n&&!1!==n&&!0!==n||(n=null),n===c)return;if(a){if(a.nodeType===Node.TEXT_NODE&&("string"==typeof n||"number"==typeof n)){const e=String(n);return a.textContent!==e&&(a.textContent=e),void(c=n)}if(a instanceof Element&&n instanceof Element&&a.tagName===n.tagName){const e=a.attributes,t=n.attributes;for(const t of e)n.hasAttribute(t.name)||a.removeAttribute(t.name);for(const e of t)a.getAttribute(e.name)!==e.value&&a.setAttribute(e.name,e.value);if(a.childNodes.length===n.childNodes.length){let e=!1;for(let t=0;t<a.childNodes.length;t++){const i=a.childNodes[t],o=n.childNodes[t];if(i.nodeType!==Node.TEXT_NODE||o.nodeType!==Node.TEXT_NODE){e=!0;break}i.textContent!==o.textContent&&(i.textContent=o.textContent)}if(!e)return void(c=n)}}}const i=s.parentNode,r=document.createDocumentFragment();if(null!=n){const e=N(n);e&&r.appendChild(e)}if(o.nextSibling!==s){let e=o.nextSibling;const t=[];for(;e&&e!==s;)t.push(e),e=e.nextSibling;t.forEach((e=>e.remove()))}r.firstChild?(i.insertBefore(r,s),a=o.nextSibling):a=null,c=n})),i}if(Array.isArray(e)){const{fragment:t,startNode:i,endNode:o}=n();let s=[],a=new Map;return r((()=>{const t=e.filter(Boolean);if(0===t.length){if(0===s.length)return;let e=i.nextSibling;const t=[];for(;e&&e!==o;)t.push(e),e=e.nextSibling;return t.forEach((e=>e.remove())),s=[],void a.clear()}if(s.length===t.length&&s.length<5){let e=!1;const n=[];let r=i.nextSibling;for(;r&&r!==o;)n.push(r),r=r.nextSibling;for(let i=0;i<t.length;i++){const o=s[i],r=t[i],a=n[i];if(o!==r){if(a.nodeType!==Node.TEXT_NODE||"string"!=typeof r&&"number"!=typeof r){e=!0;break}a.textContent=String(r)}}if(!e)return void(s=[...t])}const n=document.createDocumentFragment(),r=new Map;t.forEach(((e,t)=>{const i=e?.key||`${typeof e}:${String(e)}`;let o;a.has(i)?(o=a.get(i),a.delete(i)):o=w(e),o&&(r.set(i,o),n.appendChild(o))})),a.clear(),a=r;let c=i.nextSibling;const l=[];for(;c&&c!==o;)l.push(c),c=c.nextSibling;l.forEach((e=>e.remove())),o.parentNode.insertBefore(n,o),s=[...t]})),t}return e instanceof Node?e:document.createTextNode(String(e))},N=e=>{if(Array.isArray(e)){const t=document.createDocumentFragment();return e.forEach((e=>{const n=w(e);n&&t.appendChild(n)})),t}return e instanceof Node?e:document.createTextNode(String(e))};