olova 2.0.17 → 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.17",
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 Fragment=Symbol("Fragment");let currentEffect;const setSignal=e=>{const t=new Set;return[()=>{try{return currentEffect&&t.add(currentEffect),e}catch(e){throw console.error("Error in signal getter:",e),e}},r=>{try{return e="function"==typeof r?r(e):r,[...t].forEach((e=>{try{e()}catch(e){console.error("Error in signal subscriber:",e)}})),e}catch(e){throw console.error("Error in signal setter:",e),e}}]},setEffect=e=>{const t=()=>{try{currentEffect=t;const r=e();return currentEffect=null,r}catch(e){throw currentEffect=null,console.error("Error in effect:",e),e}};try{t()}catch(e){console.error("Error initializing effect:",e)}},setMemo=e=>{try{const[t,r]=setSignal();return setEffect((()=>{try{r(e())}catch(e){throw console.error("Error in memo function:",e),e}})),t}catch(e){return console.error("Error creating memo:",e),()=>{}}},html=(e,t,...r)=>{try{if("function"==typeof e)try{return e(t,...r)}catch(e){return console.error("Error in function component:",e),document.createComment(`Error in component: ${e.message}`)}if(e===Fragment||!e){const e=document.createDocumentFragment();return r.flat(1/0).forEach((t=>{null!=t&&e.appendChild(t instanceof Node?t:document.createTextNode(String(t)))})),e}const n=new Set(["svg","path","circle","rect","line","polygon","polyline","ellipse","g","text","defs","filter","mask","marker","pattern","linearGradient","radialGradient","stop","use","clipPath","textPath","tspan","foreignObject"]).has(e),o=n?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e);if(t)for(const[e,r]of Object.entries(t))if(null!=r)if("value"===e)o.value=r;else if("className"===e||"class"===e)o.setAttribute("class",r);else if("style"===e&&"object"==typeof r)Object.entries(r).forEach((([e,t])=>{o.style[e]=t}));else if("dangerouslySetInnerHTML"===e&&r.__html)o.innerHTML=r.__html;else if("ref"===e)"function"==typeof r?r(o):r&&"current"in r&&(r.current=o);else if(e.startsWith("on")){const t=e.slice(2).toLowerCase();o.addEventListener(t,r)}else if(n)if(e.includes(":")){const[t,n]=e.split(":"),c={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"};c[t]?o.setAttributeNS(c[t],n,r):o.setAttribute(e,r)}else o.setAttribute(e,r);else"boolean"==typeof r?r?o.setAttribute(e,""):o.removeAttribute(e):o.setAttribute(e,r);const c=(e,t)=>{try{if(null==t)return;if(Array.isArray(t))return void t.flat(1/0).forEach((t=>c(e,t)));if(t instanceof Node)e.appendChild(t);else if("function"==typeof t){const r=document.createTextNode("");e.appendChild(r),setEffect((()=>{try{const n=t();if(null==n)return void(r.textContent="");if(Array.isArray(n)){const t=document.createDocumentFragment();for(n.flat(1/0).forEach((e=>{null!=e&&t.appendChild(e instanceof Node?e:document.createTextNode(String(e)))}));r.nextSibling;)e.removeChild(r.nextSibling);e.insertBefore(t,r.nextSibling)}else if(n instanceof Node){for(;r.nextSibling;)e.removeChild(r.nextSibling);e.insertBefore(n,r.nextSibling)}else r.textContent=String(n)}catch(e){console.error("Error in reactive child function:",e),r.textContent=`Error: ${e.message}`}}))}else if("object"==typeof t&&"then"in t&&"function"==typeof t.then){const r=document.createTextNode("");e.appendChild(r),t.then((t=>{try{t instanceof Node?e.replaceChild(t,r):r.textContent=String(t)}catch(e){console.error("Error resolving promise in DOM:",e),r.textContent=`Error: ${e.message}`}})).catch((e=>{console.error("Promise rejected in DOM:",e),r.textContent=`Error: ${e.message}`}))}else e.appendChild(document.createTextNode(String(t)))}catch(e){console.error("Error appending child:",e)}};return r.forEach((e=>c(o,e))),o}catch(e){return console.error("Error creating element:",e),document.createComment(`Error creating element: ${e.message}`)}},render=(e,t,r={})=>{try{if("string"==typeof t&&!(t=document.querySelector(t)))return void console.error(`Cannot find element matching selector: ${t}`);const{clear:n=!0,hydrate:o=!1,beforeRender:c=null}=r;if(n&&!o&&(t.textContent=""),c&&"function"==typeof c)try{c(t)}catch(e){console.error("Error in beforeRender hook:",e)}let i;try{i="function"==typeof e?e():e}catch(e){console.error("Error rendering component:",e);const r=document.createElement("div");return r.className="olova-error",r.textContent=`Render Error: ${e.message}`,t.appendChild(r),r}if(!i)return null;if(Array.isArray(i)){const e=document.createDocumentFragment();return i.flat(1/0).forEach((t=>{t&&e.appendChild(t instanceof Node?t:document.createTextNode(String(t)))})),t.appendChild(e),e}return t.appendChild(i instanceof Node?i:document.createTextNode(String(i))),i}catch(e){return console.error("Error in render function:",e),null}},setRef=()=>{let e=null;return t=>(void 0!==t&&(e=t),e)},onMount=e=>{setEffect((()=>{queueMicrotask((()=>{try{e()}catch(e){console.error("Error in onMount callback:",e)}}))}))},onUnmount=e=>{setEffect((()=>()=>{try{e()}catch(e){console.error("Error in onUnmount cleanup:",e)}}))};export{setSignal,setEffect,setMemo,setRef,html,render,onMount,onUnmount,Fragment};