@prozilla-os/browser 1.1.12 → 1.1.14

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/dist/main.js CHANGED
@@ -1,20 +1,20 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('._Browser_3qqx9_1{--header-height: 3.5rem;--nav-bar-height: 2.25rem;display:flex;flex-direction:column;width:100%;height:100%}._Header_3qqx9_21{display:flex;flex-direction:column;width:100%;height:var(--header-height);background-color:var(--background-color-0)}._NavBar_3qqx9_37{display:flex;gap:1rem;justify-content:flex-start;align-items:center;width:100%;height:var(--nav-bar-height);padding:1.25rem}._IconButton_3qqx9_57{--color: var(--foreground-color-0);position:relative;display:flex;justify-content:center;align-items:center;height:1rem;width:auto;padding:0;background:none;border:none;outline:none;aspect-ratio:1;cursor:pointer}._IconButton_3qqx9_57:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#fff0;border-radius:var(--border-radius-99);transform:scale(1);transform-origin:center;transition:all .2s ease-in-out}._IconButton_3qqx9_57:hover:after,._IconButton_3qqx9_57:focus-visible:after{background-color:#ffffff1a;transform:scale(175%)}._IconButton_3qqx9_57:disabled{--color: var(--foreground-color-2)}._IconButton_3qqx9_57 svg{height:100%}._IconButton_3qqx9_57 svg path{fill:var(--color);transition:fill .1s ease-in-out}._SearchBar_3qqx9_157{flex:1;padding:.25rem .5rem;background-color:var(--background-color-2);border:none;border-radius:var(--border-radius-1);outline:none;font-family:inherit;font-size:.875em}._Bookmarks_3qqx9_179{height:calc(var(--header-height) - var(--nav-bar-height))}')),document.head.appendChild(e)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
2
- import { useHistory as N, WebView as C, isValidUrl as R, App as H, Vector2 as S, AppsConfig as y } from "@prozilla-os/core";
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('._Browser_15mg0_1{--header-height: 3.5rem;--nav-bar-height: 2.25rem;display:flex;flex-direction:column;width:100%;height:100%}._Header_15mg0_21{display:flex;flex-direction:column;width:100%;height:var(--header-height);background-color:var(--background-color-0)}._NavBar_15mg0_37{display:flex;gap:1rem;justify-content:flex-start;align-items:center;width:100%;height:var(--nav-bar-height);padding:1.25rem}._IconButton_15mg0_57{--color: var(--foreground-color-0);position:relative;display:flex;justify-content:center;align-items:center;height:1rem;width:auto;padding:0;background:none;border:none;outline:none;aspect-ratio:1;cursor:pointer}._IconButton_15mg0_57:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#fff0;border-radius:var(--border-radius-99);transform:scale(1);transform-origin:center;transition:all var(--transition-duration-1) var(--ease-in-out-default)}._IconButton_15mg0_57:hover:after,._IconButton_15mg0_57:focus-visible:after{background-color:#ffffff1a;transform:scale(175%)}._IconButton_15mg0_57:disabled{--color: var(--foreground-color-2)}._IconButton_15mg0_57 svg{height:100%}._IconButton_15mg0_57 svg path{fill:var(--color);transition:fill var(--transition-duration-0) var(--ease-in-out-default)}._SearchBar_15mg0_157{flex:1;padding:.25rem .5rem;background-color:var(--background-color-2);border:none;border-radius:var(--border-radius-1);outline:none;font-family:inherit;font-size:.875em}._Bookmarks_15mg0_179{height:calc(var(--header-height) - var(--nav-bar-height))}')),document.head.appendChild(e)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
2
+ import { useHistory as x, WebView as R, isValidUrl as H, App as S, Vector2 as y, AppsConfig as A } from "@prozilla-os/core";
3
3
  import { jsxs as u, jsx as e } from "react/jsx-runtime";
4
- import { useState as p, useRef as A, useEffect as z } from "react";
4
+ import { useState as p, useRef as z, useEffect as E } from "react";
5
5
  import { FontAwesomeIcon as a } from "@fortawesome/react-fontawesome";
6
- import { faCaretLeft as E, faCaretRight as L, faRotateRight as P, faHome as V } from "@fortawesome/free-solid-svg-icons";
7
- const W = "_Browser_3qqx9_1", $ = "_Header_3qqx9_21", j = "_NavBar_3qqx9_37", F = "_IconButton_3qqx9_57", M = "_SearchBar_3qqx9_157", O = "_Bookmarks_3qqx9_179", o = {
8
- Browser: W,
9
- Header: $,
10
- NavBar: j,
11
- IconButton: F,
12
- SearchBar: M,
13
- Bookmarks: O
14
- }, f = "https://prozilla.dev/", U = "https://www.google.com/search?igu=1";
6
+ import { faCaretLeft as L, faCaretRight as P, faRotateRight as V, faHome as W } from "@fortawesome/free-solid-svg-icons";
7
+ const $ = "_Browser_15mg0_1", j = "_Header_15mg0_21", F = "_NavBar_15mg0_37", M = "_IconButton_15mg0_57", O = "_SearchBar_15mg0_157", U = "_Bookmarks_15mg0_179", o = {
8
+ Browser: $,
9
+ Header: j,
10
+ NavBar: F,
11
+ IconButton: M,
12
+ SearchBar: O,
13
+ Bookmarks: U
14
+ }, f = "https://prozilla.dev/", q = "https://www.google.com/search?igu=1";
15
15
  function D({ url: s = f, focus: b }) {
16
- const [c, d] = p(s), [_, m] = p(s), { history: i, pushState: w, stateIndex: B, undo: v, redo: I, undoAvailable: x, redoAvailable: k } = N(s), r = A(null);
17
- z(() => {
16
+ const [c, d] = p(s), [_, m] = p(s), { history: i, pushState: w, stateIndex: B, undo: g, redo: v, undoAvailable: I, redoAvailable: k } = x(s), r = z(null);
17
+ E(() => {
18
18
  i.length !== 0 && d(i[B]);
19
19
  }, [i, B]);
20
20
  const h = () => {
@@ -23,11 +23,11 @@ function D({ url: s = f, focus: b }) {
23
23
  if (c === t)
24
24
  return h();
25
25
  d(t), m(t), w(t);
26
- }, g = (t) => {
26
+ }, N = (t) => {
27
27
  m(t.target.value);
28
- }, q = (t) => {
28
+ }, C = (t) => {
29
29
  const n = t.target.value;
30
- t.key === "Enter" && n !== "" && (R(n) ? l(n) : l(`${U}&q=${n}`));
30
+ t.key === "Enter" && n !== "" && (H(n) ? l(n) : l(`${q}&q=${n}`));
31
31
  };
32
32
  return /* @__PURE__ */ u("div", { className: o.Browser, children: [
33
33
  /* @__PURE__ */ u("div", { className: o.Header, children: [
@@ -39,10 +39,10 @@ function D({ url: s = f, focus: b }) {
39
39
  tabIndex: 0,
40
40
  className: o.IconButton,
41
41
  onClick: () => {
42
- v();
42
+ g();
43
43
  },
44
- disabled: !x,
45
- children: /* @__PURE__ */ e(a, { icon: E })
44
+ disabled: !I,
45
+ children: /* @__PURE__ */ e(a, { icon: L })
46
46
  }
47
47
  ),
48
48
  /* @__PURE__ */ e(
@@ -52,10 +52,10 @@ function D({ url: s = f, focus: b }) {
52
52
  tabIndex: 0,
53
53
  className: o.IconButton,
54
54
  onClick: () => {
55
- I();
55
+ v();
56
56
  },
57
57
  disabled: !k,
58
- children: /* @__PURE__ */ e(a, { icon: L })
58
+ children: /* @__PURE__ */ e(a, { icon: P })
59
59
  }
60
60
  ),
61
61
  /* @__PURE__ */ e(
@@ -65,7 +65,7 @@ function D({ url: s = f, focus: b }) {
65
65
  tabIndex: 0,
66
66
  className: o.IconButton,
67
67
  onClick: h,
68
- children: /* @__PURE__ */ e(a, { icon: P })
68
+ children: /* @__PURE__ */ e(a, { icon: V })
69
69
  }
70
70
  ),
71
71
  /* @__PURE__ */ e(
@@ -77,7 +77,7 @@ function D({ url: s = f, focus: b }) {
77
77
  onClick: () => {
78
78
  l(f);
79
79
  },
80
- children: /* @__PURE__ */ e(a, { icon: V })
80
+ children: /* @__PURE__ */ e(a, { icon: W })
81
81
  }
82
82
  ),
83
83
  /* @__PURE__ */ e(
@@ -88,18 +88,18 @@ function D({ url: s = f, focus: b }) {
88
88
  "aria-label": "Search bar",
89
89
  className: o.SearchBar,
90
90
  tabIndex: 0,
91
- onChange: g,
92
- onKeyDown: q
91
+ onChange: N,
92
+ onKeyDown: C
93
93
  }
94
94
  )
95
95
  ] }),
96
96
  /* @__PURE__ */ e("div", { className: o.Bookmarks })
97
97
  ] }),
98
- /* @__PURE__ */ e(C, { ref: r, source: c, title: "Browser", focus: b })
98
+ /* @__PURE__ */ e(R, { ref: r, source: c, title: "Browser", focus: b })
99
99
  ] });
100
100
  }
101
- const K = new H("Browser", "browser", D, { size: new S(700, 500) }).setIconUrl("https://os.prozilla.dev/assets/apps/icons/browser.svg").setRole(y.APP_ROLES.browser).setCategory("Utilities & tools");
102
- K.setMetadata({ name: "@prozilla-os/browser", version: "1.1.11", author: "Prozilla" });
101
+ const K = new S("Browser", "browser", D, { size: new y(700, 500) }).setIconUrl("https://os.prozilla.dev/assets/apps/icons/browser.svg").setRole(A.APP_ROLES.browser).setCategory("Utilities & tools");
102
+ K.setMetadata({ name: "@prozilla-os/browser", version: "1.1.12", author: "Prozilla" });
103
103
  export {
104
104
  K as browser
105
105
  };
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sources":["../src/constants/browser.const.ts","../src/components/Browser.tsx","../src/main.ts"],"sourcesContent":["export const HOME_URL = \"https://prozilla.dev/\";\r\nexport const SEARCH_URL = \"https://www.google.com/search?igu=1\";","import { ChangeEventHandler, KeyboardEventHandler, useEffect, useRef, useState } from \"react\";\r\nimport styles from \"./Browser.module.css\";\r\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\r\nimport { faCaretLeft, faCaretRight, faHome, faRotateRight } from \"@fortawesome/free-solid-svg-icons\";\r\nimport { isValidUrl, useHistory, WebView, WindowProps } from \"@prozilla-os/core\";\r\nimport { HOME_URL, SEARCH_URL } from \"../constants/browser.const\";\r\n\r\nexport interface BrowserProps extends WindowProps {\r\n\turl?: string;\r\n}\r\n\r\nexport function Browser({ url: startUrl = HOME_URL, focus }: BrowserProps) {\r\n\tconst [url, setUrl] = useState<string>(startUrl);\r\n\tconst [input, setInput] = useState(startUrl);\r\n\tconst { history, pushState, stateIndex, undo, redo, undoAvailable, redoAvailable } = useHistory(startUrl);\r\n\tconst ref = useRef<HTMLIFrameElement>(null);\r\n\r\n\tuseEffect(() => {\r\n\t\tif (history.length === 0)\r\n\t\t\treturn;\r\n\r\n\t\tsetUrl(history[stateIndex]);\r\n\t}, [history, stateIndex]);\r\n\r\n\tconst reload = () => {\r\n\t\tif (ref.current == null || ref.current.contentWindow == null)\r\n\t\t\treturn;\r\n\r\n\t\tref.current.contentWindow.location.href = url;\r\n\t};\r\n\r\n\tconst updateUrl = (newUrl: string) => {\r\n\t\tif (url === newUrl) {\r\n\t\t\treturn reload();\r\n\t\t}\r\n\r\n\t\tsetUrl(newUrl);\r\n\t\tsetInput(newUrl);\r\n\t\tpushState(newUrl);\r\n\t};\r\n\r\n\tconst onInputChange = (event: Event) => {\r\n\t\tsetInput((event.target as HTMLInputElement).value);\r\n\t};\r\n\r\n\tconst onKeyDown = (event: KeyboardEvent) => {\r\n\t\tconst value = (event.target as HTMLInputElement).value;\r\n\r\n\t\tif (event.key === \"Enter\" && value !== \"\") {\r\n\t\t\tif (isValidUrl(value)) {\r\n\t\t\t\tupdateUrl(value);\r\n\t\t\t} else {\r\n\t\t\t\tupdateUrl(`${SEARCH_URL}&q=${value}`);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\treturn (<div className={styles.Browser}>\r\n\t\t<div className={styles.Header}>\r\n\t\t\t<div className={styles.NavBar}>\r\n\t\t\t\t<button\r\n\t\t\t\t\ttitle=\"Back\"\r\n\t\t\t\t\ttabIndex={0}\r\n\t\t\t\t\tclassName={styles.IconButton}\r\n\t\t\t\t\tonClick={() => { undo(); }}\r\n\t\t\t\t\tdisabled={!undoAvailable}\r\n\t\t\t\t>\r\n\t\t\t\t\t<FontAwesomeIcon icon={faCaretLeft}/>\r\n\t\t\t\t</button>\r\n\t\t\t\t<button\r\n\t\t\t\t\ttitle=\"Forward\"\r\n\t\t\t\t\ttabIndex={0}\r\n\t\t\t\t\tclassName={styles.IconButton}\r\n\t\t\t\t\tonClick={() => { redo(); }}\r\n\t\t\t\t\tdisabled={!redoAvailable}\r\n\t\t\t\t>\r\n\t\t\t\t\t<FontAwesomeIcon icon={faCaretRight}/>\r\n\t\t\t\t</button>\r\n\t\t\t\t<button\r\n\t\t\t\t\ttitle=\"Reload\"\r\n\t\t\t\t\ttabIndex={0}\r\n\t\t\t\t\tclassName={styles.IconButton}\r\n\t\t\t\t\tonClick={reload}\r\n\t\t\t\t>\r\n\t\t\t\t\t<FontAwesomeIcon icon={faRotateRight}/>\r\n\t\t\t\t</button>\r\n\t\t\t\t<button\r\n\t\t\t\t\ttitle=\"Home\"\r\n\t\t\t\t\ttabIndex={0}\r\n\t\t\t\t\tclassName={styles.IconButton}\r\n\t\t\t\t\tonClick={() => { updateUrl(HOME_URL); }}\r\n\t\t\t\t>\r\n\t\t\t\t\t<FontAwesomeIcon icon={faHome}/>\r\n\t\t\t\t</button>\r\n\t\t\t\t<input\r\n\t\t\t\t\tvalue={input}\r\n\t\t\t\t\ttype=\"text\"\r\n\t\t\t\t\taria-label=\"Search bar\"\r\n\t\t\t\t\tclassName={styles.SearchBar}\r\n\t\t\t\t\ttabIndex={0}\r\n\t\t\t\t\tonChange={onInputChange as unknown as ChangeEventHandler}\r\n\t\t\t\t\tonKeyDown={onKeyDown as unknown as KeyboardEventHandler}\r\n\t\t\t\t/>\r\n\t\t\t</div>\r\n\t\t\t<div className={styles.Bookmarks}>\r\n\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<WebView ref={ref} source={url} title=\"Browser\" focus={focus}/>\r\n\t</div>);\r\n}","import { App, AppsConfig, Vector2 } from \"@prozilla-os/core\";\nimport { Browser, BrowserProps } from \"./components/Browser\";\n\nconst browser = new App<BrowserProps>(\"Browser\", \"browser\", Browser, { size: new Vector2(700, 500) })\n\t.setIconUrl(\"https://os.prozilla.dev/assets/apps/icons/browser.svg\")\n\t.setRole(AppsConfig.APP_ROLES.browser)\n\t.setCategory(\"Utilities & tools\");\nbrowser.setMetadata({ name: \"@prozilla-os/browser\", version: \"1.1.11\", author: \"Prozilla\" });\n\n\nexport { browser };"],"names":["HOME_URL","SEARCH_URL","Browser","startUrl","focus","url","setUrl","useState","input","setInput","history","pushState","stateIndex","undo","redo","undoAvailable","redoAvailable","useHistory","ref","useRef","useEffect","reload","updateUrl","newUrl","onInputChange","event","onKeyDown","value","is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AClB,UAAU;AAAA,YACV,UAAUN;AAAA,YACV,WAAAE;AAAA,UAAA;AAAA,QACD;AAAA,MAAA,GACD;AAAA,MACC,gBAAAK,EAAA,OAAA,EAAI,WAAWD,EAAO,UAEvB,CAAA;AAAA,IAAA,GACD;AAAA,sBACCO,GAAQ,EAAA,KAAAnB,GAAU,QAAQb,GAAK,OAAM,WAAU,OAAAD,GAAa;AAAA,EAC9D,EAAA,CAAA;AACD;AC3GM,MAAAkC,IAAU,IAAIC,EAAkB,WAAW,WAAWrC,GAAS,EAAE,MAAM,IAAIsC,EAAQ,KAAK,GAAG,GAAG,EAClG,WAAW,uDAAuD,EAClE,QAAQC,EAAW,UAAU,OAAO,EACpC,YAAY,mBAAmB;AACjCH,EAAQ,YAAY,EAAE,MAAM,wBAAwB,SAAS,UAAU,QAAQ,YAAY;"}
1
+ {"version":3,"file":"main.js","sources":["../src/constants/browser.const.ts","../src/components/Browser.tsx","../src/main.ts"],"sourcesContent":["export const HOME_URL = \"https://prozilla.dev/\";\r\nexport const SEARCH_URL = \"https://www.google.com/search?igu=1\";","import { ChangeEventHandler, KeyboardEventHandler, useEffect, useRef, useState } from \"react\";\r\nimport styles from \"./Browser.module.css\";\r\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\r\nimport { faCaretLeft, faCaretRight, faHome, faRotateRight } from \"@fortawesome/free-solid-svg-icons\";\r\nimport { isValidUrl, useHistory, WebView, WindowProps } from \"@prozilla-os/core\";\r\nimport { HOME_URL, SEARCH_URL } from \"../constants/browser.const\";\r\n\r\nexport interface BrowserProps extends WindowProps {\r\n\turl?: string;\r\n}\r\n\r\nexport function Browser({ url: startUrl = HOME_URL, focus }: BrowserProps) {\r\n\tconst [url, setUrl] = useState<string>(startUrl);\r\n\tconst [input, setInput] = useState(startUrl);\r\n\tconst { history, pushState, stateIndex, undo, redo, undoAvailable, redoAvailable } = useHistory(startUrl);\r\n\tconst ref = useRef<HTMLIFrameElement>(null);\r\n\r\n\tuseEffect(() => {\r\n\t\tif (history.length === 0)\r\n\t\t\treturn;\r\n\r\n\t\tsetUrl(history[stateIndex]);\r\n\t}, [history, stateIndex]);\r\n\r\n\tconst reload = () => {\r\n\t\tif (ref.current == null || ref.current.contentWindow == null)\r\n\t\t\treturn;\r\n\r\n\t\tref.current.contentWindow.location.href = url;\r\n\t};\r\n\r\n\tconst updateUrl = (newUrl: string) => {\r\n\t\tif (url === newUrl) {\r\n\t\t\treturn reload();\r\n\t\t}\r\n\r\n\t\tsetUrl(newUrl);\r\n\t\tsetInput(newUrl);\r\n\t\tpushState(newUrl);\r\n\t};\r\n\r\n\tconst onInputChange = (event: Event) => {\r\n\t\tsetInput((event.target as HTMLInputElement).value);\r\n\t};\r\n\r\n\tconst onKeyDown = (event: KeyboardEvent) => {\r\n\t\tconst value = (event.target as HTMLInputElement).value;\r\n\r\n\t\tif (event.key === \"Enter\" && value !== \"\") {\r\n\t\t\tif (isValidUrl(value)) {\r\n\t\t\t\tupdateUrl(value);\r\n\t\t\t} else {\r\n\t\t\t\tupdateUrl(`${SEARCH_URL}&q=${value}`);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\treturn (<div className={styles.Browser}>\r\n\t\t<div className={styles.Header}>\r\n\t\t\t<div className={styles.NavBar}>\r\n\t\t\t\t<button\r\n\t\t\t\t\ttitle=\"Back\"\r\n\t\t\t\t\ttabIndex={0}\r\n\t\t\t\t\tclassName={styles.IconButton}\r\n\t\t\t\t\tonClick={() => { undo(); }}\r\n\t\t\t\t\tdisabled={!undoAvailable}\r\n\t\t\t\t>\r\n\t\t\t\t\t<FontAwesomeIcon icon={faCaretLeft}/>\r\n\t\t\t\t</button>\r\n\t\t\t\t<button\r\n\t\t\t\t\ttitle=\"Forward\"\r\n\t\t\t\t\ttabIndex={0}\r\n\t\t\t\t\tclassName={styles.IconButton}\r\n\t\t\t\t\tonClick={() => { redo(); }}\r\n\t\t\t\t\tdisabled={!redoAvailable}\r\n\t\t\t\t>\r\n\t\t\t\t\t<FontAwesomeIcon icon={faCaretRight}/>\r\n\t\t\t\t</button>\r\n\t\t\t\t<button\r\n\t\t\t\t\ttitle=\"Reload\"\r\n\t\t\t\t\ttabIndex={0}\r\n\t\t\t\t\tclassName={styles.IconButton}\r\n\t\t\t\t\tonClick={reload}\r\n\t\t\t\t>\r\n\t\t\t\t\t<FontAwesomeIcon icon={faRotateRight}/>\r\n\t\t\t\t</button>\r\n\t\t\t\t<button\r\n\t\t\t\t\ttitle=\"Home\"\r\n\t\t\t\t\ttabIndex={0}\r\n\t\t\t\t\tclassName={styles.IconButton}\r\n\t\t\t\t\tonClick={() => { updateUrl(HOME_URL); }}\r\n\t\t\t\t>\r\n\t\t\t\t\t<FontAwesomeIcon icon={faHome}/>\r\n\t\t\t\t</button>\r\n\t\t\t\t<input\r\n\t\t\t\t\tvalue={input}\r\n\t\t\t\t\ttype=\"text\"\r\n\t\t\t\t\taria-label=\"Search bar\"\r\n\t\t\t\t\tclassName={styles.SearchBar}\r\n\t\t\t\t\ttabIndex={0}\r\n\t\t\t\t\tonChange={onInputChange as unknown as ChangeEventHandler}\r\n\t\t\t\t\tonKeyDown={onKeyDown as unknown as KeyboardEventHandler}\r\n\t\t\t\t/>\r\n\t\t\t</div>\r\n\t\t\t<div className={styles.Bookmarks}>\r\n\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<WebView ref={ref} source={url} title=\"Browser\" focus={focus}/>\r\n\t</div>);\r\n}","import { App, AppsConfig, Vector2 } from \"@prozilla-os/core\";\nimport { Browser, BrowserProps } from \"./components/Browser\";\n\nconst browser = new App<BrowserProps>(\"Browser\", \"browser\", Browser, { size: new Vector2(700, 500) })\n\t.setIconUrl(\"https://os.prozilla.dev/assets/apps/icons/browser.svg\")\n\t.setRole(AppsConfig.APP_ROLES.browser)\n\t.setCategory(\"Utilities & tools\");\nbrowser.setMetadata({ name: \"@prozilla-os/browser\", version: \"1.1.12\", author: \"Prozilla\" });\n\n\nexport { browser };"],"names":["HOME_URL","SEARCH_URL","Browser","startUrl","focus","url","setUrl","useState","input","setInput","history","pushState","stateIndex","undo","redo","undoAvailable","redoAvailable","useHistory","ref","useRef","useEffect","reload","updateUrl","newUrl","onInputChange","event","onKeyDown","value","isValidUrl","jsxs","styles","jsx","FontAwesomeIcon","faCaretLeft","faCaretRight","faRotateRight","faHome","WebView","browser","App","Vector2","AppsConfig"],"mappings":";;;;;;;;;;;;GAAaA,IAAW,yBACXC,IAAa;ACUnB,SAASC,EAAQ,EAAE,KAAKC,IAAWH,GAAU,OAAAI,KAAuB;AAC1E,QAAM,CAACC,GAAKC,CAAM,IAAIC,EAAiBJ,CAAQ,GACzC,CAACK,GAAOC,CAAQ,IAAIF,EAASJ,CAAQ,GACrC,EAAE,SAAAO,GAAS,WAAAC,GAAW,YAAAC,GAAY,MAAAC,GAAM,MAAAC,GAAM,eAAAC,GAAe,eAAAC,EAAA,IAAkBC,EAAWd,CAAQ,GAClGe,IAAMC,EAA0B,IAAI;AAE1C,EAAAC,EAAU,MAAM;AACf,IAAIV,EAAQ,WAAW,KAGhBJ,EAAAI,EAAQE,CAAU,CAAC;AAAA,EAAA,GACxB,CAACF,GAASE,CAAU,CAAC;AAExB,QAAMS,IAAS,MAAM;AACpB,IAAIH,EAAI,WAAW,QAAQA,EAAI,QAAQ,iBAAiB,SAGpDA,EAAA,QAAQ,cAAc,SAAS,OAAOb;AAAA,EAAA,GAGrCiB,IAAY,CAACC,MAAmB;AACrC,QAAIlB,MAAQkB;AACX,aAAOF,EAAO;AAGf,IAAAf,EAAOiB,CAAM,GACbd,EAASc,CAAM,GACfZ,EAAUY,CAAM;AAAA,EAAA,GAGXC,IAAgB,CAACC,MAAiB;AAC7B,IAAAhB,EAAAgB,EAAM,OAA4B,KAAK;AAAA,EAAA,GAG5CC,IAAY,CAACD,MAAyB;AACrC,UAAAE,IAASF,EAAM,OAA4B;AAEjD,IAAIA,EAAM,QAAQ,WAAWE,MAAU,OAClCC,EAAWD,CAAK,IACnBL,EAAUK,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AAAA,QAC/B;AAAA,QACA,gBAAAL;AAAA,UAAC;AAAA,UAAA;AAAA,YACA,OAAOvB;AAAA,YACP,MAAK;AAAA,YACL,cAAW;AAAA,YACX,WAAWsB,EAAO;AAAA,YAClB,UAAU;AAAA,YACV,UAAUN;AAAA,YACV,WAAAE;AAAA,UAAA;AAAA,QACD;AAAA,MAAA,GACD;AAAA,MACC,gBAAAK,EAAA,OAAA,EAAI,WAAWD,EAAO,UAEvB,CAAA;AAAA,IAAA,GACD;AAAA,sBACCO,GAAQ,EAAA,KAAAnB,GAAU,QAAQb,GAAK,OAAM,WAAU,OAAAD,GAAa;AAAA,EAC9D,EAAA,CAAA;AACD;AC3GM,MAAAkC,IAAU,IAAIC,EAAkB,WAAW,WAAWrC,GAAS,EAAE,MAAM,IAAIsC,EAAQ,KAAK,GAAG,GAAG,EAClG,WAAW,uDAAuD,EAClE,QAAQC,EAAW,UAAU,OAAO,EACpC,YAAY,mBAAmB;AACjCH,EAAQ,YAAY,EAAE,MAAM,wBAAwB,SAAS,UAAU,QAAQ,YAAY;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prozilla-os/browser",
3
3
  "description": "A ProzillaOS application for browsing the internet.",
4
- "version": "1.1.12",
4
+ "version": "1.1.14",
5
5
  "homepage": "https://os.prozilla.dev/browser",
6
6
  "author": {
7
7
  "name": "Prozilla",
@@ -20,7 +20,7 @@
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
22
  "react": "^18.3.1",
23
- "@prozilla-os/core": "1.3.7"
23
+ "@prozilla-os/core": "1.3.9"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "^20.14.5",
@@ -30,7 +30,7 @@
30
30
  "vite": "^5.4.8",
31
31
  "vite-plugin-dts": "^3.9.1",
32
32
  "vite-plugin-lib-inject-css": "^2.1.1",
33
- "@prozilla-os/dev-tools": "1.1.4"
33
+ "@prozilla-os/dev-tools": "1.1.6"
34
34
  },
35
35
  "files": [
36
36
  "dist"