Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify a lot of code #54

Merged
merged 30 commits into from
Mar 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
914e868
Delete everything
trickypr Mar 17, 2024
9300f52
🚧 Devtools button
trickypr Mar 17, 2024
056c0b4
🚧 Basic frame loading
trickypr Mar 17, 2024
d64fb15
Very basic toolbar
trickypr Mar 17, 2024
f983bb5
Back and foward buttons enabled
trickypr Mar 18, 2024
bfb9071
💄 Deprioritise less important url information
trickypr Mar 18, 2024
2b53e13
✨ Add very simple autocomplete options
trickypr Mar 18, 2024
a5b936e
✨ Fetch autocomplete from duckduckgo's api
trickypr Mar 18, 2024
45c50ed
💄 Use cursed url styling (hint, its better!)
trickypr Mar 18, 2024
9281ad4
🚧 Layout completions
trickypr Mar 18, 2024
5126bbe
Use website theme-color as header color if they provide it
trickypr Mar 19, 2024
d6e4dc9
✨ Functional URL box
trickypr Mar 20, 2024
14d9738
💄 Hide development options in hamburgur
trickypr Mar 20, 2024
aced72c
💄 Noone likes url encoding characters
trickypr Mar 20, 2024
8c81e04
💄 Assorted theme cleanup
trickypr Mar 21, 2024
9993266
✨ Tabbed browser
trickypr Mar 24, 2024
159cde1
💄 Make the tabs look passable
trickypr Mar 24, 2024
8695562
✨ Close button for tabs
trickypr Mar 24, 2024
728a612
✨ Tab favicons
trickypr Mar 26, 2024
30f3c85
✨ Add page title to tabs
trickypr Mar 26, 2024
aa01880
✨ New tab button
trickypr Mar 26, 2024
a6b675e
✨ Page actions are back
trickypr Mar 29, 2024
d4b65e1
🐛 Fix partial crash when opening multiple tabs
trickypr Mar 29, 2024
4541cc5
🚧 Initial support for multi-tab select
trickypr Mar 29, 2024
24f9114
✨ Bulk tab closing
trickypr Mar 29, 2024
962177c
🚧 Very gittery tab drags
trickypr Mar 30, 2024
319d130
✨ Smooth tab reordering
trickypr Mar 30, 2024
f6196c3
✨ Webpage security icon
trickypr Mar 31, 2024
d3baca1
✅ Fix tests
trickypr Mar 31, 2024
b6f90bb
📄 Fix license headers
trickypr Mar 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions apps/actors/lib/LinkHandlerParent.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
export class LinkHandlerParent extends JSWindowActorParent {
/** @param {{ name: 'Link:SetIcon'; data: { iconURL: string } }} aMsg */
receiveMessage(aMsg) {
/** @type {Window} */
const win = this.browsingContext.topChromeWindow

switch (aMsg.name) {
case 'Link:SetIcon':
return win.windowApi.tabs.setIcon(
this.browsingContext.embedderElement,
aMsg.data.iconURL,
)
return win.eventBus.emit('iconUpdate', {
browserId: this.browsingContext.embedderElement.browserId,
iconUrl: aMsg.data.iconURL,
})
}
}
}
92 changes: 92 additions & 0 deletions apps/actors/lib/ThemeMetaChild.sys.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// @ts-check
/// <reference types="@browser/link" />

/**
* @typedef {object} CurrentPageColors
* @property {string} [meta]
* @property {string} [body]
*/

export class ThemeMetaChild extends JSWindowActorChild {
/** @type {CurrentPageColors} */
currentColorOptions = {}

/**
* @param {DOMMetaAddedEvent|DOMMetaChangedEvent} event
*/
handleMetaEvent(event) {
const { target } = event

if (target.name === 'theme-color') {
this.currentColorOptions.meta =
target.getAttribute('content') || undefined

this.sendUpdatedThemeColors()
}
}

/**
* @param {PageShowEvent} event
*/
handlePageLoad(event) {
const document = event.target
this.currentColorOptions.body =
this.getHeaderColor(document.body, document.body) || undefined

this.sendUpdatedThemeColors()
}

/**
* @param {HTMLElement} element
* @param {HTMLElement} body
* @returns {string | null}
*/
getHeaderColor(element, body) {
if (!element.getBoundingClientRect) {
return null
}

if (element != body && element.getBoundingClientRect().y != 0) {
return null
}

let elementColor = null

if (element.firstChild) {
elementColor = this.getHeaderColor(element.firstChild, body)
}

if (!elementColor) {
elementColor = this.contentWindow.getComputedStyle(element).background
if (
elementColor.toLowerCase() == 'none' ||
elementColor.toLowerCase() == 'transperent'
) {
return null
}
}

return elementColor
}

sendUpdatedThemeColors() {
this.sendAsyncMessage('Theme:ColorsUpdated', this.currentColorOptions)
}

/**
* @param {PageShowEvent | DOMMetaAddedEvent | DOMMetaChangedEvent} event
*/
handleEvent(event) {
switch (event.type) {
case 'DOMMetaAdded':
case 'DOMMetaChanged':
return this.handleMetaEvent(event)
case 'pageshow':
return this.handlePageLoad(event)
}
}
}
20 changes: 20 additions & 0 deletions apps/actors/lib/ThemeMetaParent.sys.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// @ts-check
/// <reference types="@browser/link" />

export class ThemeMetaParent extends JSWindowActorParent {
receiveMessage(aMsg) {
/** @type {Window} */
const win = this.browsingContext.topChromeWindow

if (aMsg.name === 'Theme:ColorsUpdated') {
win.eventBus.emit('themeUpdate', {
...aMsg.data,
browserId: this.browsingContext.embedderElement.browserId,
})
}
}
}
11 changes: 6 additions & 5 deletions apps/content/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
"license": "ISC",
"devDependencies": {
"@browser/link": "workspace:*",
"@melt-ui/pp": "^0.3.0",
"@total-typescript/ts-reset": "^0.5.1",
"@tsconfig/svelte": "^5.0.2",
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.8.1",
"gecko-types": "github:quark-platform/gecko-types",
"html-webpack-plugin": "^5.6.0",
"mini-css-extract-plugin": "^2.7.6",
"postcss-loader": "^7.3.4",
"style-loader": "^3.3.3",
"svelte": "^4.2.8",
"svelte-loader": "^3.1.9",
"svelte": "^4.2.12",
"svelte-loader": "^3.2.0",
"svelte-preprocess": "^5.1.3",
"svelte-sequential-preprocessor": "^2.0.1",
"ts-loader": "^9.5.1",
Expand All @@ -33,14 +33,15 @@
"webpack-license-plugin": "^4.4.2"
},
"dependencies": {
"@amadeus-it-group/tansu": "^1.0.0",
"@catppuccin/palette": "^1.0.1",
"@experiment/shared": "workspace:*",
"@melt-ui/svelte": "^0.67.0",
"colorjs.io": "^0.5.0",
"fnts": "^2.1.0",
"mitt": "^3.0.1",
"nanoid": "^5.0.4",
"remixicon": "^4.0.1",
"snarkdown": "^2.0.0",
"svelte-remixicon": "^2.4.0",
"zora": "^5.2.0"
}
}
22 changes: 0 additions & 22 deletions apps/content/patches/@[email protected]

This file was deleted.

45 changes: 0 additions & 45 deletions apps/content/src/bookmarks/Bookmarks.svelte

This file was deleted.

10 changes: 0 additions & 10 deletions apps/content/src/bookmarks/bookmarks.ts

This file was deleted.

65 changes: 0 additions & 65 deletions apps/content/src/bookmarks/components/BookmarkEditor.svelte

This file was deleted.

67 changes: 0 additions & 67 deletions apps/content/src/bookmarks/components/BookmarkItem.svelte

This file was deleted.

Loading
Loading