Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4d019c4
Init 3rd-party-optimizer plugin
kurtextrem Aug 21, 2025
8ee1690
Allow custom vite config
kurtextrem Aug 21, 2025
6b721ec
bump yarn / yarn dedupe
kurtextrem Aug 21, 2025
2cbb1eb
fix lint errors
kurtextrem Aug 21, 2025
f71f187
Add final URL
kurtextrem Aug 27, 2025
777fafc
Add HTMLFormElement override
kurtextrem Aug 27, 2025
c181eba
Add MutationObserver for monitoring `dataLayer`
kurtextrem Aug 29, 2025
34cda89
use postTask if possible, add performance timeline entries
kurtextrem Aug 29, 2025
e03996a
Fix `shouldWaitForLoad`
kurtextrem Aug 29, 2025
fd409e4
Make sure events are only handled once
kurtextrem Aug 29, 2025
705455e
update lockfile after rebase
kurtextrem Sep 1, 2025
9f0fe3d
fix spacings
kurtextrem Sep 1, 2025
5993f31
Update package.json
kurtextrem Sep 1, 2025
2a06dca
upgrade to yarn 4.9.4
kurtextrem Sep 1, 2025
f52cce3
use es2021
kurtextrem Sep 1, 2025
3d8ba57
add globals.d.ts
kurtextrem Sep 1, 2025
204088f
Convert to Tailwind
kurtextrem Sep 1, 2025
3edfdc6
add framer-plugin & framer/vite-config to package.json
kurtextrem Sep 1, 2025
1de8140
fix items-center
kurtextrem Sep 1, 2025
0221f4e
add explicit case
kurtextrem Sep 1, 2025
429a5a0
restore framer-plugin@3.3.2
kurtextrem Sep 1, 2025
e0cf874
Revert "restore framer-plugin@3.3.2"
kurtextrem Sep 1, 2025
2be862b
bump all plugins up to framer-plugins@3.5.2
kurtextrem Sep 1, 2025
8ff363d
Ensure we call the original if the proto chain returns undefined
kurtextrem Sep 1, 2025
4328847
Document `scrollend` and `resize` listeners
kurtextrem Sep 4, 2025
4891bcf
Add `isInputPending` check
kurtextrem Sep 4, 2025
445aa1a
Ensure we always call the underlying method & retain `this`
kurtextrem Sep 8, 2025
3c76342
v1.0.1
kurtextrem Sep 8, 2025
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
716 changes: 358 additions & 358 deletions .yarn/releases/yarn-4.9.2.cjs → .yarn/releases/yarn-4.9.4.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ supportedArchitectures:
- linux
- win32

yarnPath: .yarn/releases/yarn-4.9.2.cjs
yarnPath: .yarn/releases/yarn-4.9.4.cjs
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plugins",
"packageManager": "yarn@4.9.2",
"packageManager": "yarn@4.9.4",
"private": true,
"license": "MIT",
"workspaces": [
Expand All @@ -21,7 +21,7 @@
"g:check-vitest": "cd $INIT_CWD && vitest run",
"g:dev": "cd $INIT_CWD && run g:vite",
"g:preview": "cd $INIT_CWD && run g:vite preview",
"g:vite": "cd $INIT_CWD && NODE_OPTIONS='--no-warnings=ExperimentalWarning' vite --config $PROJECT_CWD/packages/vite-config/src/index.ts",
"g:vite": "cd $INIT_CWD && NODE_OPTIONS='--no-warnings=ExperimentalWarning' vite --config ${VITE_CONFIG_PATH:-$PROJECT_CWD/packages/vite-config/src/index.ts}",
"preview": "turbo run preview --concurrency=40"
},
"devDependencies": {
Expand Down
21 changes: 21 additions & 0 deletions plugins/3rd-party-optimizer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 3rd-Party Optimizer

This plugin installs a snippet that optimizes how 3rd-party analytics scripts interact with the main-thread, to improve Core Web Vitals (INP).

See also [yieldGTMCalls.md](./yieldGTMCalls.md) for detailed docs.

## Quickstart

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Learn more: https://www.framer.com/developers/plugins/introduction
6 changes: 6 additions & 0 deletions plugins/3rd-party-optimizer/framer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"id": "d84d6c",
"name": "3rd-Party Optimizer",
"modes": ["canvas"],
"icon": "/icon.svg"
}
14 changes: 14 additions & 0 deletions plugins/3rd-party-optimizer/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/icon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>3rd-Party Optimizer</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

27 changes: 27 additions & 0 deletions plugins/3rd-party-optimizer/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "3rd-party-optimizer",
Comment thread
kurtextrem marked this conversation as resolved.
"private": true,
"version": "1.0.1",
"type": "module",
"scripts": {
"dev": "VITE_CONFIG_PATH=$(pwd)/vite.config.ts run g:dev",
"build": "VITE_CONFIG_PATH=$(pwd)/vite.config.ts run g:build",
"check-biome": "run g:check-biome",
"check-eslint": "run g:check-eslint",
"preview": "VITE_CONFIG_PATH=$(pwd)/vite.config.ts run g:preview",
"pack": "npx framer-plugin-tools@latest pack",
"check-typescript": "run g:check-typescript"
},
"dependencies": {
"framer-plugin": "^3.5.2",
"react": "^18.2",
"react-dom": "^18.2"
},
"devDependencies": {
"@framer/vite-config": "workspace:*",
"@types/node": "^22",
"@types/react": "^18.2",
"@types/react-dom": "^18.2",
"esbuild": "^0.25.9"
}
}
1 change: 1 addition & 0 deletions plugins/3rd-party-optimizer/public/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions plugins/3rd-party-optimizer/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@import "tailwindcss";
@import "framer-plugin/framer.css" layer(base);

@layer base {
input,
button,
textarea,
select {
padding: initial;
}

p {
color: var(--framer-color-text-tertiary);
text-align: center;
}
}
96 changes: 96 additions & 0 deletions plugins/3rd-party-optimizer/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import type { CustomCode } from "framer-plugin"
import { framer } from "framer-plugin"
import { useLayoutEffect, useSyncExternalStore } from "react"
import "./App.css"

import scriptSource from "virtual:yield-gtm-calls"
import warning from "./warning.svg?url"

let currentCustomCode: CustomCode | null = null

const subscribe = (callback: () => void) => {
return framer.subscribeToCustomCode(customCode => {
currentCustomCode = customCode
callback()
})
}
const getSnapshot = () => currentCustomCode

export function App() {
const customCode = useSyncExternalStore(subscribe, getSnapshot)

const scriptAdded = !!customCode?.headStart.html
const scriptOutdated = scriptAdded && customCode.headStart.html !== scriptSource
const toggleScript = (update?: boolean) => {
void framer.setCustomCode({
html: scriptAdded && !update ? "" : scriptSource,
location: "headStart",
})
}

useLayoutEffect(() => {
let height = 137
if (customCode?.headStart.disabled) {
height += 10
}
if (scriptOutdated) {
height += 60
}

void framer.showUI({
position: "top right",
width: 260,
height,
})
}, [customCode?.headStart.disabled, scriptOutdated])

return (
<main className="flex flex-col gap-[15px] | items-start | h-full | p-[15px] pt-0">
<div className="framer-divider" />

{!customCode?.headStart.disabled && (
<p>
Add a script to your custom HTML to improve site performance when using 3rd-party tracking scripts.{" "}
<a href="https://www.framer.com/marketplace/plugins/3rd-party-optimizer/" target="_blank">
Learn more
</a>
</p>
)}

{customCode?.headStart.disabled && (
<div className="flex flex-col gap-[10px] | justify-center items-center">
<div className="flex | justify-center | w-full | py-[4px]">
<img src={warning} alt="Warning" />
</div>
<p>
The script is disabled. Please go to
<br /> Site Settings → General and enable it.
</p>
</div>
)}

{scriptOutdated && (
<>
<div className="framer-divider" />
<div className="flex | justify-between items-center | w-full">
<p>New script version available</p>
<button
className="framer-button-primary bg-[var(--framer-color-tint-dimmed)] text-[var(--framer-color-tint)] hover:bg-[var(--framer-color-tint-dimmed)] focus:bg-[var(--framer-color-tint-dimmed)] | rounded-[6px] | text-[10px] font-500 | w-[46px] h-[20px]"
onClick={toggleScript.bind(null, true)}
>
Update
</button>
</div>
<div className="framer-divider" />
</>
)}

<button
className={`framer-button-secondary${scriptOutdated ? "" : " mt-[5px]"}`}
onClick={toggleScript.bind(null, false)}
>
{scriptAdded ? "Remove Script" : "Add Script"}
</button>
</main>
)
}
4 changes: 4 additions & 0 deletions plugins/3rd-party-optimizer/src/globals.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module "virtual:yield-gtm-calls" {
const content: string
export default content
}
12 changes: 12 additions & 0 deletions plugins/3rd-party-optimizer/src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from "react"
import ReactDOM from "react-dom/client"
import { App } from "./App.tsx"

const root = document.getElementById("root")
if (!root) throw new Error("Root element not found")

ReactDOM.createRoot(root).render(
<React.StrictMode>
<App />
</React.StrictMode>
)
5 changes: 5 additions & 0 deletions plugins/3rd-party-optimizer/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="vite/client" />

interface ViteTypeOptions {
strictImportMetaEnv: unknown
}
1 change: 1 addition & 0 deletions plugins/3rd-party-optimizer/src/warning.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading