mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-23 02:36:05 +00:00
feat: cleanup and update plugins 2
This commit is contained in:
parent
0145f28d50
commit
8838be0aad
9 changed files with 533 additions and 1551 deletions
|
|
@ -26,8 +26,9 @@
|
|||
"scripts": {
|
||||
"assemble:android:prod": "cd android && ./gradlew assembleRelease && cd ..",
|
||||
"assemble:android:stage": "cd android && ./gradlew assembleDebug && cd ..",
|
||||
"prebuild": "node ./tools/git-version.js",
|
||||
"prebuild": "node ./tools/git-version.js && npm run build:packages",
|
||||
"build": "npm run buildAllElectron:noTests:prod",
|
||||
"build:packages": "node ./packages/build-packages.js",
|
||||
"buildAllElectron:noTests:prod": "npm run lint && npm run buildFrontend:prod:es6 && npm run electron:build",
|
||||
"buildAllElectron:prod": "npm run preCheck && npm run buildFrontend:prod:es6 && npm run electron:build",
|
||||
"buildAllElectron:stage": "npm run preCheck && npm run buildFrontend:stage:es6 && npm run electron:build",
|
||||
|
|
|
|||
49
packages/README.md
Normal file
49
packages/README.md
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
# Super Productivity Packages
|
||||
|
||||
This directory contains plugin packages and the plugin API for Super Productivity.
|
||||
|
||||
## Structure
|
||||
|
||||
- `plugin-api/` - TypeScript definitions for the plugin API
|
||||
- `plugin-dev/` - Plugin development examples and tools
|
||||
- `api-test-plugin/` - Basic API test plugin
|
||||
- `procrastination-buster/` - Example SolidJS-based plugin
|
||||
- `yesterday-tasks-plugin/` - Simple plugin showing yesterday's tasks
|
||||
- `boilerplate-solid-js/` - Template for creating new SolidJS plugins (not built)
|
||||
- `sync-md/` - Markdown sync plugin (not built)
|
||||
|
||||
## Building Packages
|
||||
|
||||
All packages are built automatically when running the main build process:
|
||||
|
||||
```bash
|
||||
npm run build:packages
|
||||
```
|
||||
|
||||
This command:
|
||||
|
||||
1. Builds the plugin-api TypeScript definitions
|
||||
2. Builds plugins that require compilation (e.g., procrastination-buster)
|
||||
3. Copies plugin files to `src/assets/` for inclusion in the app
|
||||
|
||||
## Development
|
||||
|
||||
To work on a specific plugin:
|
||||
|
||||
```bash
|
||||
cd plugin-dev/[plugin-name]
|
||||
npm install
|
||||
npm run dev
|
||||
```
|
||||
|
||||
## Adding a New Plugin
|
||||
|
||||
1. Create a new directory in `plugin-dev/`
|
||||
2. Add the plugin configuration to `/packages/build-packages.js`
|
||||
3. Run `npm run build:packages` to test the build
|
||||
|
||||
## Notes
|
||||
|
||||
- The `boilerplate-solid-js` and `sync-md` plugins are development templates and are not included in production builds
|
||||
- Plugin files are automatically copied to `src/assets/` during the build process
|
||||
- The build script handles dependency installation automatically
|
||||
194
packages/build-packages.js
Executable file
194
packages/build-packages.js
Executable file
|
|
@ -0,0 +1,194 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const { exec } = require('child_process');
|
||||
const { promisify } = require('util');
|
||||
const fs = require('fs').promises;
|
||||
const path = require('path');
|
||||
|
||||
const execAsync = promisify(exec);
|
||||
|
||||
// Colors for console output
|
||||
const colors = {
|
||||
reset: '\x1b[0m',
|
||||
bright: '\x1b[1m',
|
||||
green: '\x1b[32m',
|
||||
yellow: '\x1b[33m',
|
||||
red: '\x1b[31m',
|
||||
cyan: '\x1b[36m',
|
||||
};
|
||||
|
||||
function log(message, color = '') {
|
||||
console.log(`${color}${message}${colors.reset}`);
|
||||
}
|
||||
|
||||
// Plugin configurations
|
||||
const plugins = [
|
||||
{
|
||||
name: 'plugin-api',
|
||||
path: 'packages/plugin-api',
|
||||
buildCommand: 'npm run build',
|
||||
skipCopy: true, // TypeScript definitions, no need to copy
|
||||
},
|
||||
{
|
||||
name: 'api-test-plugin',
|
||||
path: 'packages/plugin-dev/api-test-plugin',
|
||||
files: ['manifest.json', 'plugin.js', 'index.html', 'icon.svg'],
|
||||
},
|
||||
{
|
||||
name: 'procrastination-buster',
|
||||
path: 'packages/plugin-dev/procrastination-buster',
|
||||
buildCommand: 'npm run build',
|
||||
distFiles: [
|
||||
'manifest.json',
|
||||
'plugin.js',
|
||||
'index.html',
|
||||
'index.js',
|
||||
'index.css',
|
||||
'icon.svg',
|
||||
],
|
||||
sourcePath: 'dist',
|
||||
},
|
||||
{
|
||||
name: 'yesterday-tasks-plugin',
|
||||
path: 'packages/plugin-dev/yesterday-tasks-plugin',
|
||||
files: ['manifest.json', 'plugin.js', 'index.html', 'icon.svg'],
|
||||
},
|
||||
// Explicitly excluding:
|
||||
// - boilerplate-solid-js
|
||||
// - sync-md
|
||||
];
|
||||
|
||||
async function ensureDir(dir) {
|
||||
try {
|
||||
await fs.mkdir(dir, { recursive: true });
|
||||
} catch (error) {
|
||||
// Directory might already exist
|
||||
}
|
||||
}
|
||||
|
||||
async function copyFile(src, dest) {
|
||||
try {
|
||||
await fs.copyFile(src, dest);
|
||||
return true;
|
||||
} catch (error) {
|
||||
if (error.code !== 'ENOENT') {
|
||||
log(` ⚠️ Failed to copy ${path.basename(src)}: ${error.message}`, colors.yellow);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async function buildPlugin(plugin) {
|
||||
const startTime = Date.now();
|
||||
log(`\n📦 Processing ${plugin.name}...`, colors.cyan);
|
||||
|
||||
try {
|
||||
// Check if plugin directory exists
|
||||
const pluginPath = path.resolve(plugin.path);
|
||||
try {
|
||||
await fs.access(pluginPath);
|
||||
} catch {
|
||||
throw new Error(`Plugin directory not found: ${plugin.path}`);
|
||||
}
|
||||
|
||||
// Run build command if specified
|
||||
if (plugin.buildCommand) {
|
||||
log(` Building...`, colors.yellow);
|
||||
const packageJsonPath = path.join(pluginPath, 'package.json');
|
||||
|
||||
// Check if package.json exists and install dependencies if needed
|
||||
try {
|
||||
await fs.access(packageJsonPath);
|
||||
const nodeModulesPath = path.join(pluginPath, 'node_modules');
|
||||
try {
|
||||
await fs.access(nodeModulesPath);
|
||||
} catch {
|
||||
log(` Installing dependencies...`, colors.yellow);
|
||||
await execAsync(`cd ${pluginPath} && npm install`);
|
||||
}
|
||||
} catch {
|
||||
// No package.json, skip install
|
||||
}
|
||||
|
||||
await execAsync(`cd ${pluginPath} && ${plugin.buildCommand}`);
|
||||
}
|
||||
|
||||
// Copy files to assets if not skipped
|
||||
if (!plugin.skipCopy) {
|
||||
const targetDir = path.join('src/assets', plugin.name);
|
||||
await ensureDir(targetDir);
|
||||
|
||||
const filesToCopy = plugin.distFiles || plugin.files || [];
|
||||
const sourcePath = plugin.sourcePath
|
||||
? path.join(pluginPath, plugin.sourcePath)
|
||||
: pluginPath;
|
||||
|
||||
let copiedCount = 0;
|
||||
for (const file of filesToCopy) {
|
||||
const src = path.join(sourcePath, file);
|
||||
const dest = path.join(targetDir, file);
|
||||
if (await copyFile(src, dest)) {
|
||||
copiedCount++;
|
||||
}
|
||||
}
|
||||
|
||||
log(
|
||||
` ✅ Copied ${copiedCount}/${filesToCopy.length} files to assets`,
|
||||
colors.green,
|
||||
);
|
||||
}
|
||||
|
||||
const duration = ((Date.now() - startTime) / 1000).toFixed(1);
|
||||
log(`✅ ${plugin.name} completed (${duration}s)`, colors.green);
|
||||
|
||||
return { plugin: plugin.name, success: true, duration };
|
||||
} catch (error) {
|
||||
const duration = ((Date.now() - startTime) / 1000).toFixed(1);
|
||||
log(`❌ ${plugin.name} failed: ${error.message} (${duration}s)`, colors.red);
|
||||
return { plugin: plugin.name, success: false, error: error.message, duration };
|
||||
}
|
||||
}
|
||||
|
||||
async function buildAll() {
|
||||
log('🚀 Building all packages...', colors.bright);
|
||||
const startTime = Date.now();
|
||||
|
||||
// Build plugins sequentially to avoid conflicts
|
||||
const results = [];
|
||||
for (const plugin of plugins) {
|
||||
const result = await buildPlugin(plugin);
|
||||
results.push(result);
|
||||
}
|
||||
|
||||
// Summary
|
||||
const totalDuration = ((Date.now() - startTime) / 1000).toFixed(1);
|
||||
const successful = results.filter((r) => r.success).length;
|
||||
const failed = results.filter((r) => !r.success).length;
|
||||
|
||||
log('\n📊 Build Summary:', colors.bright);
|
||||
log(` Total packages: ${plugins.length}`);
|
||||
log(` Successful: ${successful}`, colors.green);
|
||||
if (failed > 0) {
|
||||
log(` Failed: ${failed}`, colors.red);
|
||||
results
|
||||
.filter((r) => !r.success)
|
||||
.forEach((r) => {
|
||||
log(` - ${r.plugin}: ${r.error}`, colors.red);
|
||||
});
|
||||
}
|
||||
log(` Total time: ${totalDuration}s`);
|
||||
|
||||
if (failed > 0) {
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// Run if called directly
|
||||
if (require.main === module) {
|
||||
buildAll().catch((error) => {
|
||||
log(`\n❌ Build failed: ${error.message}`, colors.red);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = { buildAll };
|
||||
|
|
@ -5,8 +5,9 @@
|
|||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"scripts": {
|
||||
"build": "tsc --emitDeclarationOnly",
|
||||
"build": "tsc",
|
||||
"build:watch": "tsc --emitDeclarationOnly --watch",
|
||||
"clean": "rm -rf dist",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"keywords": [
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@
|
|||
"module": "commonjs",
|
||||
"lib": ["ES2020", "DOM"],
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src",
|
||||
"strict": true,
|
||||
|
|
@ -14,8 +12,7 @@
|
|||
"forceConsistentCasingInFileNames": true,
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"noEmitOnError": true,
|
||||
"noEmit": false
|
||||
"noEmitOnError": true
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,58 +1,58 @@
|
|||
(function () {
|
||||
const t = document.createElement('link').relList;
|
||||
if (t && t.supports && t.supports('modulepreload')) return;
|
||||
for (const i of document.querySelectorAll('link[rel="modulepreload"]')) r(i);
|
||||
new MutationObserver((i) => {
|
||||
for (const s of i)
|
||||
if (s.type === 'childList')
|
||||
for (const l of s.addedNodes)
|
||||
for (const s of document.querySelectorAll('link[rel="modulepreload"]')) r(s);
|
||||
new MutationObserver((s) => {
|
||||
for (const i of s)
|
||||
if (i.type === 'childList')
|
||||
for (const l of i.addedNodes)
|
||||
l.tagName === 'LINK' && l.rel === 'modulepreload' && r(l);
|
||||
}).observe(document, { childList: !0, subtree: !0 });
|
||||
function n(i) {
|
||||
const s = {};
|
||||
function n(s) {
|
||||
const i = {};
|
||||
return (
|
||||
i.integrity && (s.integrity = i.integrity),
|
||||
i.referrerPolicy && (s.referrerPolicy = i.referrerPolicy),
|
||||
i.crossOrigin === 'use-credentials'
|
||||
? (s.credentials = 'include')
|
||||
: i.crossOrigin === 'anonymous'
|
||||
? (s.credentials = 'omit')
|
||||
: (s.credentials = 'same-origin'),
|
||||
s
|
||||
s.integrity && (i.integrity = s.integrity),
|
||||
s.referrerPolicy && (i.referrerPolicy = s.referrerPolicy),
|
||||
s.crossOrigin === 'use-credentials'
|
||||
? (i.credentials = 'include')
|
||||
: s.crossOrigin === 'anonymous'
|
||||
? (i.credentials = 'omit')
|
||||
: (i.credentials = 'same-origin'),
|
||||
i
|
||||
);
|
||||
}
|
||||
function r(i) {
|
||||
if (i.ep) return;
|
||||
i.ep = !0;
|
||||
const s = n(i);
|
||||
fetch(i.href, s);
|
||||
function r(s) {
|
||||
if (s.ep) return;
|
||||
s.ep = !0;
|
||||
const i = n(s);
|
||||
fetch(s.href, i);
|
||||
}
|
||||
})();
|
||||
const ce = !0,
|
||||
ue = (e, t) => e === t,
|
||||
fe = Symbol('solid-track'),
|
||||
de = Symbol('solid-dev-component'),
|
||||
B = { equals: ue };
|
||||
let he = ie;
|
||||
const ae = !0,
|
||||
ce = (e, t) => e === t,
|
||||
ue = Symbol('solid-track'),
|
||||
fe = Symbol('solid-dev-component'),
|
||||
N = { equals: ce };
|
||||
let de = ne;
|
||||
const T = 1,
|
||||
U = 2,
|
||||
pe = {};
|
||||
W = 2,
|
||||
he = {};
|
||||
var d = null;
|
||||
let G = null,
|
||||
let V = null,
|
||||
ge = null,
|
||||
h = null,
|
||||
p = null,
|
||||
A = null,
|
||||
j = 0;
|
||||
function N(e, t) {
|
||||
function B(e, t) {
|
||||
const n = h,
|
||||
r = d,
|
||||
i = e.length === 0,
|
||||
s = t === void 0 ? r : t,
|
||||
l = i
|
||||
s = e.length === 0,
|
||||
i = t === void 0 ? r : t,
|
||||
l = s
|
||||
? { owned: null, cleanups: null, context: null, owner: null }
|
||||
: { owned: null, cleanups: null, context: s ? s.context : null, owner: s },
|
||||
o = i
|
||||
: { owned: null, cleanups: null, context: i ? i.context : null, owner: i },
|
||||
o = s
|
||||
? () =>
|
||||
e(() => {
|
||||
throw new Error(
|
||||
|
|
@ -67,31 +67,31 @@ function N(e, t) {
|
|||
(h = n), (d = r);
|
||||
}
|
||||
}
|
||||
function V(e, t) {
|
||||
t = t ? Object.assign({}, B, t) : B;
|
||||
function q(e, t) {
|
||||
t = t ? Object.assign({}, N, t) : N;
|
||||
const n = {
|
||||
value: e,
|
||||
observers: null,
|
||||
observerSlots: null,
|
||||
comparator: t.equals || void 0,
|
||||
};
|
||||
t.name && (n.name = t.name), t.internal ? (n.internal = !0) : be(n);
|
||||
const r = (i) => (typeof i == 'function' && (i = i(n.value)), te(n, i));
|
||||
return [ee.bind(n), r];
|
||||
t.name && (n.name = t.name), t.internal ? (n.internal = !0) : we(n);
|
||||
const r = (s) => (typeof s == 'function' && (s = s(n.value)), ee(n, s));
|
||||
return [z.bind(n), r];
|
||||
}
|
||||
function q(e, t, n) {
|
||||
const r = X(e, t, !1, T, n);
|
||||
function G(e, t, n) {
|
||||
const r = H(e, t, !1, T, n);
|
||||
L(r);
|
||||
}
|
||||
function M(e, t, n) {
|
||||
n = n ? Object.assign({}, B, n) : B;
|
||||
const r = X(e, t, !0, 0, n);
|
||||
n = n ? Object.assign({}, N, n) : N;
|
||||
const r = H(e, t, !0, 0, n);
|
||||
return (
|
||||
(r.observers = null),
|
||||
(r.observerSlots = null),
|
||||
(r.comparator = n.equals || void 0),
|
||||
L(r),
|
||||
ee.bind(r)
|
||||
z.bind(r)
|
||||
);
|
||||
}
|
||||
function I(e) {
|
||||
|
|
@ -104,7 +104,7 @@ function I(e) {
|
|||
h = t;
|
||||
}
|
||||
}
|
||||
function me(e) {
|
||||
function pe(e) {
|
||||
return (
|
||||
d === null
|
||||
? console.warn(
|
||||
|
|
@ -116,8 +116,8 @@ function me(e) {
|
|||
e
|
||||
);
|
||||
}
|
||||
function we(e, t) {
|
||||
const n = X(() => I(() => (Object.assign(e, { [de]: !0 }), e(t))), void 0, !0, 0);
|
||||
function me(e, t) {
|
||||
const n = H(() => I(() => (Object.assign(e, { [fe]: !0 }), e(t))), void 0, !0, 0);
|
||||
return (
|
||||
(n.props = t),
|
||||
(n.observers = null),
|
||||
|
|
@ -128,15 +128,15 @@ function we(e, t) {
|
|||
n.tValue !== void 0 ? n.tValue : n.value
|
||||
);
|
||||
}
|
||||
function be(e) {
|
||||
function we(e) {
|
||||
d && (d.sourceMap ? d.sourceMap.push(e) : (d.sourceMap = [e]), (e.graph = d));
|
||||
}
|
||||
function ee() {
|
||||
function z() {
|
||||
if (this.sources && this.state)
|
||||
if (this.state === T) L(this);
|
||||
else {
|
||||
const e = p;
|
||||
(p = null), R(() => W(this), !1), (p = e);
|
||||
(p = null), R(() => U(this), !1), (p = e);
|
||||
}
|
||||
if (h) {
|
||||
const e = this.observers ? this.observers.length : 0;
|
||||
|
|
@ -149,7 +149,7 @@ function ee() {
|
|||
}
|
||||
return this.value;
|
||||
}
|
||||
function te(e, t, n) {
|
||||
function ee(e, t, n) {
|
||||
let r = e.value;
|
||||
return (
|
||||
(!e.comparator || !e.comparator(r, t)) &&
|
||||
|
|
@ -157,18 +157,18 @@ function te(e, t, n) {
|
|||
e.observers &&
|
||||
e.observers.length &&
|
||||
R(() => {
|
||||
for (let i = 0; i < e.observers.length; i += 1) {
|
||||
const s = e.observers[i],
|
||||
l = G && G.running;
|
||||
l && G.disposed.has(s),
|
||||
(l ? !s.tState : !s.state) &&
|
||||
(s.pure ? p.push(s) : A.push(s), s.observers && se(s)),
|
||||
l || (s.state = T);
|
||||
for (let s = 0; s < e.observers.length; s += 1) {
|
||||
const i = e.observers[s],
|
||||
l = V && V.running;
|
||||
l && V.disposed.has(i),
|
||||
(l ? !i.tState : !i.state) &&
|
||||
(i.pure ? p.push(i) : A.push(i), i.observers && se(i)),
|
||||
l || (i.state = T);
|
||||
}
|
||||
if (p.length > 1e6)
|
||||
throw (
|
||||
((p = []),
|
||||
ce ? new Error('Potential Infinite Loop Detected.') : new Error())
|
||||
ae ? new Error('Potential Infinite Loop Detected.') : new Error())
|
||||
);
|
||||
}, !1)),
|
||||
t
|
||||
|
|
@ -178,12 +178,12 @@ function L(e) {
|
|||
if (!e.fn) return;
|
||||
D(e);
|
||||
const t = j;
|
||||
ye(e, e.value, t);
|
||||
be(e, e.value, t);
|
||||
}
|
||||
function ye(e, t, n) {
|
||||
function be(e, t, n) {
|
||||
let r;
|
||||
const i = d,
|
||||
s = h;
|
||||
const s = d,
|
||||
i = h;
|
||||
h = d = e;
|
||||
try {
|
||||
r = e.fn(t);
|
||||
|
|
@ -191,17 +191,17 @@ function ye(e, t, n) {
|
|||
return (
|
||||
e.pure && ((e.state = T), e.owned && e.owned.forEach(D), (e.owned = null)),
|
||||
(e.updatedAt = n + 1),
|
||||
re(l)
|
||||
ie(l)
|
||||
);
|
||||
} finally {
|
||||
(h = s), (d = i);
|
||||
(h = i), (d = s);
|
||||
}
|
||||
(!e.updatedAt || e.updatedAt <= n) &&
|
||||
(e.updatedAt != null && 'observers' in e ? te(e, r) : (e.value = r),
|
||||
(e.updatedAt != null && 'observers' in e ? ee(e, r) : (e.value = r),
|
||||
(e.updatedAt = n));
|
||||
}
|
||||
function X(e, t, n, r = T, i) {
|
||||
const s = {
|
||||
function H(e, t, n, r = T, s) {
|
||||
const i = {
|
||||
fn: e,
|
||||
state: r,
|
||||
updatedAt: null,
|
||||
|
|
@ -219,22 +219,22 @@ function X(e, t, n, r = T, i) {
|
|||
? console.warn(
|
||||
'computations created outside a `createRoot` or `render` will never be disposed',
|
||||
)
|
||||
: d !== pe && (d.owned ? d.owned.push(s) : (d.owned = [s])),
|
||||
i && i.name && (s.name = i.name),
|
||||
s
|
||||
: d !== he && (d.owned ? d.owned.push(i) : (d.owned = [i])),
|
||||
s && s.name && (i.name = s.name),
|
||||
i
|
||||
);
|
||||
}
|
||||
function ne(e) {
|
||||
function te(e) {
|
||||
if (e.state === 0) return;
|
||||
if (e.state === U) return W(e);
|
||||
if (e.state === W) return U(e);
|
||||
if (e.suspense && I(e.suspense.inFallback)) return e.suspense.effects.push(e);
|
||||
const t = [e];
|
||||
for (; (e = e.owner) && (!e.updatedAt || e.updatedAt < j); ) e.state && t.push(e);
|
||||
for (let n = t.length - 1; n >= 0; n--)
|
||||
if (((e = t[n]), e.state === T)) L(e);
|
||||
else if (e.state === U) {
|
||||
else if (e.state === W) {
|
||||
const r = p;
|
||||
(p = null), R(() => W(e, t[0]), !1), (p = r);
|
||||
(p = null), R(() => U(e, t[0]), !1), (p = r);
|
||||
}
|
||||
}
|
||||
function R(e, t) {
|
||||
|
|
@ -243,35 +243,35 @@ function R(e, t) {
|
|||
t || (p = []), A ? (n = !0) : (A = []), j++;
|
||||
try {
|
||||
const r = e();
|
||||
return ve(n), r;
|
||||
return ye(n), r;
|
||||
} catch (r) {
|
||||
n || (A = null), (p = null), re(r);
|
||||
n || (A = null), (p = null), ie(r);
|
||||
}
|
||||
}
|
||||
function ve(e) {
|
||||
if ((p && (ie(p), (p = null)), e)) return;
|
||||
function ye(e) {
|
||||
if ((p && (ne(p), (p = null)), e)) return;
|
||||
const t = A;
|
||||
(A = null), t.length && R(() => he(t), !1);
|
||||
(A = null), t.length && R(() => de(t), !1);
|
||||
}
|
||||
function ie(e) {
|
||||
for (let t = 0; t < e.length; t++) ne(e[t]);
|
||||
function ne(e) {
|
||||
for (let t = 0; t < e.length; t++) te(e[t]);
|
||||
}
|
||||
function W(e, t) {
|
||||
function U(e, t) {
|
||||
e.state = 0;
|
||||
for (let n = 0; n < e.sources.length; n += 1) {
|
||||
const r = e.sources[n];
|
||||
if (r.sources) {
|
||||
const i = r.state;
|
||||
i === T
|
||||
? r !== t && (!r.updatedAt || r.updatedAt < j) && ne(r)
|
||||
: i === U && W(r, t);
|
||||
const s = r.state;
|
||||
s === T
|
||||
? r !== t && (!r.updatedAt || r.updatedAt < j) && te(r)
|
||||
: s === W && U(r, t);
|
||||
}
|
||||
}
|
||||
}
|
||||
function se(e) {
|
||||
for (let t = 0; t < e.observers.length; t += 1) {
|
||||
const n = e.observers[t];
|
||||
n.state || ((n.state = U), n.pure ? p.push(n) : A.push(n), n.observers && se(n));
|
||||
n.state || ((n.state = W), n.pure ? p.push(n) : A.push(n), n.observers && se(n));
|
||||
}
|
||||
}
|
||||
function D(e) {
|
||||
|
|
@ -280,11 +280,11 @@ function D(e) {
|
|||
for (; e.sources.length; ) {
|
||||
const n = e.sources.pop(),
|
||||
r = e.sourceSlots.pop(),
|
||||
i = n.observers;
|
||||
if (i && i.length) {
|
||||
const s = i.pop(),
|
||||
s = n.observers;
|
||||
if (s && s.length) {
|
||||
const i = s.pop(),
|
||||
l = n.observerSlots.pop();
|
||||
r < i.length && ((s.sourceSlots[l] = r), (i[r] = s), (n.observerSlots[r] = l));
|
||||
r < s.length && ((i.sourceSlots[l] = r), (s[r] = i), (n.observerSlots[r] = l));
|
||||
}
|
||||
}
|
||||
if (e.tOwned) {
|
||||
|
|
@ -301,41 +301,41 @@ function D(e) {
|
|||
}
|
||||
(e.state = 0), delete e.sourceMap;
|
||||
}
|
||||
function Se(e) {
|
||||
function ve(e) {
|
||||
return e instanceof Error
|
||||
? e
|
||||
: new Error(typeof e == 'string' ? e : 'Unknown error', { cause: e });
|
||||
}
|
||||
function re(e, t = d) {
|
||||
throw Se(e);
|
||||
function ie(e, t = d) {
|
||||
throw ve(e);
|
||||
}
|
||||
const $e = Symbol('fallback');
|
||||
function Y(e) {
|
||||
const Se = Symbol('fallback');
|
||||
function X(e) {
|
||||
for (let t = 0; t < e.length; t++) e[t]();
|
||||
}
|
||||
function _e(e, t, n = {}) {
|
||||
function $e(e, t, n = {}) {
|
||||
let r = [],
|
||||
i = [],
|
||||
s = [],
|
||||
i = [],
|
||||
l = 0,
|
||||
o = t.length > 1 ? [] : null;
|
||||
return (
|
||||
me(() => Y(s)),
|
||||
pe(() => X(i)),
|
||||
() => {
|
||||
let c = e() || [],
|
||||
u = c.length,
|
||||
f,
|
||||
a;
|
||||
return (
|
||||
c[fe],
|
||||
c[ue],
|
||||
I(() => {
|
||||
let g, $, w, C, E, b, y, S, _;
|
||||
let m, $, w, C, E, b, y, S, x;
|
||||
if (u === 0)
|
||||
l !== 0 && (Y(s), (s = []), (r = []), (i = []), (l = 0), o && (o = [])),
|
||||
l !== 0 && (X(i), (i = []), (r = []), (s = []), (l = 0), o && (o = [])),
|
||||
n.fallback &&
|
||||
((r = [$e]), (i[0] = N((ae) => ((s[0] = ae), n.fallback()))), (l = 1));
|
||||
((r = [Se]), (s[0] = B((le) => ((i[0] = le), n.fallback()))), (l = 1));
|
||||
else if (l === 0) {
|
||||
for (i = new Array(u), a = 0; a < u; a++) (r[a] = c[a]), (i[a] = N(m));
|
||||
for (s = new Array(u), a = 0; a < u; a++) (r[a] = c[a]), (s[a] = B(g));
|
||||
l = u;
|
||||
} else {
|
||||
for (
|
||||
|
|
@ -348,31 +348,31 @@ function _e(e, t, n = {}) {
|
|||
b++
|
||||
);
|
||||
for (y = l - 1, S = u - 1; y >= b && S >= b && r[y] === c[S]; y--, S--)
|
||||
(w[S] = i[y]), (C[S] = s[y]), o && (E[S] = o[y]);
|
||||
for (g = new Map(), $ = new Array(S + 1), a = S; a >= b; a--)
|
||||
(_ = c[a]), (f = g.get(_)), ($[a] = f === void 0 ? -1 : f), g.set(_, a);
|
||||
(w[S] = s[y]), (C[S] = i[y]), o && (E[S] = o[y]);
|
||||
for (m = new Map(), $ = new Array(S + 1), a = S; a >= b; a--)
|
||||
(x = c[a]), (f = m.get(x)), ($[a] = f === void 0 ? -1 : f), m.set(x, a);
|
||||
for (f = b; f <= y; f++)
|
||||
(_ = r[f]),
|
||||
(a = g.get(_)),
|
||||
(x = r[f]),
|
||||
(a = m.get(x)),
|
||||
a !== void 0 && a !== -1
|
||||
? ((w[a] = i[f]),
|
||||
(C[a] = s[f]),
|
||||
? ((w[a] = s[f]),
|
||||
(C[a] = i[f]),
|
||||
o && (E[a] = o[f]),
|
||||
(a = $[a]),
|
||||
g.set(_, a))
|
||||
: s[f]();
|
||||
m.set(x, a))
|
||||
: i[f]();
|
||||
for (a = b; a < u; a++)
|
||||
a in w
|
||||
? ((i[a] = w[a]), (s[a] = C[a]), o && ((o[a] = E[a]), o[a](a)))
|
||||
: (i[a] = N(m));
|
||||
(i = i.slice(0, (l = u))), (r = c.slice(0));
|
||||
? ((s[a] = w[a]), (i[a] = C[a]), o && ((o[a] = E[a]), o[a](a)))
|
||||
: (s[a] = B(g));
|
||||
(s = s.slice(0, (l = u))), (r = c.slice(0));
|
||||
}
|
||||
return i;
|
||||
return s;
|
||||
})
|
||||
);
|
||||
function m(g) {
|
||||
if (((s[a] = g), o)) {
|
||||
const [$, w] = V(a, { name: 'index' });
|
||||
function g(m) {
|
||||
if (((i[a] = m), o)) {
|
||||
const [$, w] = q(a, { name: 'index' });
|
||||
return (o[a] = w), t(c[a], $);
|
||||
}
|
||||
return t(c[a]);
|
||||
|
|
@ -380,15 +380,15 @@ function _e(e, t, n = {}) {
|
|||
}
|
||||
);
|
||||
}
|
||||
function x(e, t) {
|
||||
return we(e, t || {});
|
||||
function k(e, t) {
|
||||
return me(e, t || {});
|
||||
}
|
||||
const xe = (e) =>
|
||||
`Attempting to access a stale value from <${e}> that could possibly be undefined. This may occur because you are reading the accessor returned from the component at a time where it has already been unmounted. We recommend cleaning up any stale timers or async, or reading from the initial condition.`;
|
||||
function J(e) {
|
||||
function Y(e) {
|
||||
const t = 'fallback' in e && { fallback: () => e.fallback };
|
||||
return M(
|
||||
_e(() => e.each, e.children, t || void 0),
|
||||
$e(() => e.each, e.children, t || void 0),
|
||||
void 0,
|
||||
{ name: 'value' },
|
||||
);
|
||||
|
|
@ -396,24 +396,24 @@ function J(e) {
|
|||
function P(e) {
|
||||
const t = e.keyed,
|
||||
n = M(() => e.when, void 0, { name: 'condition value' }),
|
||||
r = t ? n : M(n, void 0, { equals: (i, s) => !i == !s, name: 'condition' });
|
||||
r = t ? n : M(n, void 0, { equals: (s, i) => !s == !i, name: 'condition' });
|
||||
return M(
|
||||
() => {
|
||||
const i = r();
|
||||
if (i) {
|
||||
const s = e.children;
|
||||
return typeof s == 'function' && s.length > 0
|
||||
const s = r();
|
||||
if (s) {
|
||||
const i = e.children;
|
||||
return typeof i == 'function' && i.length > 0
|
||||
? I(() =>
|
||||
s(
|
||||
i(
|
||||
t
|
||||
? i
|
||||
? s
|
||||
: () => {
|
||||
if (!I(r)) throw xe('Show');
|
||||
return n();
|
||||
},
|
||||
),
|
||||
)
|
||||
: s;
|
||||
: i;
|
||||
}
|
||||
return e.fallback;
|
||||
},
|
||||
|
|
@ -428,43 +428,43 @@ globalThis &&
|
|||
)
|
||||
: (globalThis.Solid$$ = !0));
|
||||
const ke = (e) => M(() => e());
|
||||
function Ae(e, t, n) {
|
||||
function _e(e, t, n) {
|
||||
let r = n.length,
|
||||
i = t.length,
|
||||
s = r,
|
||||
s = t.length,
|
||||
i = r,
|
||||
l = 0,
|
||||
o = 0,
|
||||
c = t[i - 1].nextSibling,
|
||||
c = t[s - 1].nextSibling,
|
||||
u = null;
|
||||
for (; l < i || o < s; ) {
|
||||
for (; l < s || o < i; ) {
|
||||
if (t[l] === n[o]) {
|
||||
l++, o++;
|
||||
continue;
|
||||
}
|
||||
for (; t[i - 1] === n[s - 1]; ) i--, s--;
|
||||
if (i === l) {
|
||||
const f = s < r ? (o ? n[o - 1].nextSibling : n[s - o]) : c;
|
||||
for (; o < s; ) e.insertBefore(n[o++], f);
|
||||
} else if (s === o) for (; l < i; ) (!u || !u.has(t[l])) && t[l].remove(), l++;
|
||||
else if (t[l] === n[s - 1] && n[o] === t[i - 1]) {
|
||||
const f = t[--i].nextSibling;
|
||||
for (; t[s - 1] === n[i - 1]; ) s--, i--;
|
||||
if (s === l) {
|
||||
const f = i < r ? (o ? n[o - 1].nextSibling : n[i - o]) : c;
|
||||
for (; o < i; ) e.insertBefore(n[o++], f);
|
||||
} else if (i === o) for (; l < s; ) (!u || !u.has(t[l])) && t[l].remove(), l++;
|
||||
else if (t[l] === n[i - 1] && n[o] === t[s - 1]) {
|
||||
const f = t[--s].nextSibling;
|
||||
e.insertBefore(n[o++], t[l++].nextSibling),
|
||||
e.insertBefore(n[--s], f),
|
||||
(t[i] = n[s]);
|
||||
e.insertBefore(n[--i], f),
|
||||
(t[s] = n[i]);
|
||||
} else {
|
||||
if (!u) {
|
||||
u = new Map();
|
||||
let a = o;
|
||||
for (; a < s; ) u.set(n[a], a++);
|
||||
for (; a < i; ) u.set(n[a], a++);
|
||||
}
|
||||
const f = u.get(t[l]);
|
||||
if (f != null)
|
||||
if (o < f && f < s) {
|
||||
if (o < f && f < i) {
|
||||
let a = l,
|
||||
m = 1,
|
||||
g;
|
||||
for (; ++a < i && a < s && !((g = u.get(t[a])) == null || g !== f + m); ) m++;
|
||||
if (m > f - o) {
|
||||
g = 1,
|
||||
m;
|
||||
for (; ++a < s && a < i && !((m = u.get(t[a])) == null || m !== f + g); ) g++;
|
||||
if (g > f - o) {
|
||||
const $ = t[l];
|
||||
for (; o < f; ) e.insertBefore(n[o++], $);
|
||||
} else e.replaceChild(n[o++], t[l++]);
|
||||
|
|
@ -473,51 +473,51 @@ function Ae(e, t, n) {
|
|||
}
|
||||
}
|
||||
}
|
||||
const Q = '_$DX_DELEGATE';
|
||||
function Te(e, t, n, r = {}) {
|
||||
const J = '_$DX_DELEGATE';
|
||||
function Ae(e, t, n, r = {}) {
|
||||
if (!t)
|
||||
throw new Error(
|
||||
"The `element` passed to `render(..., element)` doesn't exist. Make sure `element` exists in the document.",
|
||||
);
|
||||
let i;
|
||||
let s;
|
||||
return (
|
||||
N((s) => {
|
||||
(i = s), t === document ? e() : v(t, e(), t.firstChild ? null : void 0, n);
|
||||
B((i) => {
|
||||
(s = i), t === document ? e() : v(t, e(), t.firstChild ? null : void 0, n);
|
||||
}, r.owner),
|
||||
() => {
|
||||
i(), (t.textContent = '');
|
||||
s(), (t.textContent = '');
|
||||
}
|
||||
);
|
||||
}
|
||||
function k(e, t, n, r) {
|
||||
let i;
|
||||
const s = () => {
|
||||
function _(e, t, n, r) {
|
||||
let s;
|
||||
const i = () => {
|
||||
const o = document.createElement('template');
|
||||
return (o.innerHTML = e), o.content.firstChild;
|
||||
},
|
||||
l = () => (i || (i = s())).cloneNode(!0);
|
||||
l = () => (s || (s = i())).cloneNode(!0);
|
||||
return (l.cloneNode = l), l;
|
||||
}
|
||||
function oe(e, t = window.document) {
|
||||
const n = t[Q] || (t[Q] = new Set());
|
||||
for (let r = 0, i = e.length; r < i; r++) {
|
||||
const s = e[r];
|
||||
n.has(s) || (n.add(s), t.addEventListener(s, Ee));
|
||||
function re(e, t = window.document) {
|
||||
const n = t[J] || (t[J] = new Set());
|
||||
for (let r = 0, s = e.length; r < s; r++) {
|
||||
const i = e[r];
|
||||
n.has(i) || (n.add(i), t.addEventListener(i, Ce));
|
||||
}
|
||||
}
|
||||
function Ce(e, t, n, r) {
|
||||
function Te(e, t, n, r) {
|
||||
Array.isArray(n) ? ((e[`$$${t}`] = n[0]), (e[`$$${t}Data`] = n[1])) : (e[`$$${t}`] = n);
|
||||
}
|
||||
function v(e, t, n, r) {
|
||||
if ((n !== void 0 && !r && (r = []), typeof t != 'function')) return F(e, t, r, n);
|
||||
q((i) => F(e, t(), i, n), r);
|
||||
G((s) => F(e, t(), s, n), r);
|
||||
}
|
||||
function Ee(e) {
|
||||
function Ce(e) {
|
||||
let t = e.target;
|
||||
const n = `$$${e.type}`,
|
||||
r = e.target,
|
||||
i = e.currentTarget,
|
||||
s = (c) => Object.defineProperty(e, 'target', { configurable: !0, value: c }),
|
||||
s = e.currentTarget,
|
||||
i = (c) => Object.defineProperty(e, 'target', { configurable: !0, value: c }),
|
||||
l = () => {
|
||||
const c = t[n];
|
||||
if (c && !t.disabled) {
|
||||
|
|
@ -529,7 +529,7 @@ function Ee(e) {
|
|||
typeof t.host != 'string' &&
|
||||
!t.host._$host &&
|
||||
t.contains(e.target) &&
|
||||
s(t.host),
|
||||
i(t.host),
|
||||
!0
|
||||
);
|
||||
},
|
||||
|
|
@ -546,24 +546,24 @@ function Ee(e) {
|
|||
e.composedPath)
|
||||
) {
|
||||
const c = e.composedPath();
|
||||
s(c[0]);
|
||||
i(c[0]);
|
||||
for (let u = 0; u < c.length - 2 && ((t = c[u]), !!l()); u++) {
|
||||
if (t._$host) {
|
||||
(t = t._$host), o();
|
||||
break;
|
||||
}
|
||||
if (t.parentNode === i) break;
|
||||
if (t.parentNode === s) break;
|
||||
}
|
||||
} else o();
|
||||
s(r);
|
||||
i(r);
|
||||
}
|
||||
function F(e, t, n, r, i) {
|
||||
function F(e, t, n, r, s) {
|
||||
for (; typeof n == 'function'; ) n = n();
|
||||
if (t === n) return n;
|
||||
const s = typeof t,
|
||||
const i = typeof t,
|
||||
l = r !== void 0;
|
||||
if (((e = (l && n[0] && n[0].parentNode) || e), s === 'string' || s === 'number')) {
|
||||
if (s === 'number' && ((t = t.toString()), t === n)) return n;
|
||||
if (((e = (l && n[0] && n[0].parentNode) || e), i === 'string' || i === 'number')) {
|
||||
if (i === 'number' && ((t = t.toString()), t === n)) return n;
|
||||
if (l) {
|
||||
let o = n[0];
|
||||
o && o.nodeType === 3
|
||||
|
|
@ -574,11 +574,11 @@ function F(e, t, n, r, i) {
|
|||
n !== '' && typeof n == 'string'
|
||||
? (n = e.firstChild.data = t)
|
||||
: (n = e.textContent = t);
|
||||
} else if (t == null || s === 'boolean') n = O(e, n, r);
|
||||
} else if (t == null || i === 'boolean') n = O(e, n, r);
|
||||
else {
|
||||
if (s === 'function')
|
||||
if (i === 'function')
|
||||
return (
|
||||
q(() => {
|
||||
G(() => {
|
||||
let o = t();
|
||||
for (; typeof o == 'function'; ) o = o();
|
||||
n = F(e, o, n, r);
|
||||
|
|
@ -588,10 +588,10 @@ function F(e, t, n, r, i) {
|
|||
if (Array.isArray(t)) {
|
||||
const o = [],
|
||||
c = n && Array.isArray(n);
|
||||
if (K(o, t, n, i)) return q(() => (n = F(e, o, n, r, !0))), () => n;
|
||||
if (K(o, t, n, s)) return G(() => (n = F(e, o, n, r, !0))), () => n;
|
||||
if (o.length === 0) {
|
||||
if (((n = O(e, n, r)), l)) return n;
|
||||
} else c ? (n.length === 0 ? Z(e, o, r) : Ae(e, n, o)) : (n && O(e), Z(e, o));
|
||||
} else c ? (n.length === 0 ? Q(e, o, r) : _e(e, n, o)) : (n && O(e), Q(e, o));
|
||||
n = o;
|
||||
} else if (t.nodeType) {
|
||||
if (Array.isArray(n)) {
|
||||
|
|
@ -607,19 +607,19 @@ function F(e, t, n, r, i) {
|
|||
return n;
|
||||
}
|
||||
function K(e, t, n, r) {
|
||||
let i = !1;
|
||||
for (let s = 0, l = t.length; s < l; s++) {
|
||||
let o = t[s],
|
||||
let s = !1;
|
||||
for (let i = 0, l = t.length; i < l; i++) {
|
||||
let o = t[i],
|
||||
c = n && n[e.length],
|
||||
u;
|
||||
if (!(o == null || o === !0 || o === !1))
|
||||
if ((u = typeof o) == 'object' && o.nodeType) e.push(o);
|
||||
else if (Array.isArray(o)) i = K(e, o, c) || i;
|
||||
else if (Array.isArray(o)) s = K(e, o, c) || s;
|
||||
else if (u === 'function')
|
||||
if (r) {
|
||||
for (; typeof o == 'function'; ) o = o();
|
||||
i = K(e, Array.isArray(o) ? o : [o], Array.isArray(c) ? c : [c]) || i;
|
||||
} else e.push(o), (i = !0);
|
||||
s = K(e, Array.isArray(o) ? o : [o], Array.isArray(c) ? c : [c]) || s;
|
||||
} else e.push(o), (s = !0);
|
||||
else {
|
||||
const f = String(o);
|
||||
c && c.nodeType === 3 && c.data === f
|
||||
|
|
@ -627,31 +627,30 @@ function K(e, t, n, r) {
|
|||
: e.push(document.createTextNode(f));
|
||||
}
|
||||
}
|
||||
return i;
|
||||
return s;
|
||||
}
|
||||
function Z(e, t, n = null) {
|
||||
for (let r = 0, i = t.length; r < i; r++) e.insertBefore(t[r], n);
|
||||
function Q(e, t, n = null) {
|
||||
for (let r = 0, s = t.length; r < s; r++) e.insertBefore(t[r], n);
|
||||
}
|
||||
function O(e, t, n, r) {
|
||||
if (n === void 0) return (e.textContent = '');
|
||||
const i = r || document.createTextNode('');
|
||||
const s = r || document.createTextNode('');
|
||||
if (t.length) {
|
||||
let s = !1;
|
||||
let i = !1;
|
||||
for (let l = t.length - 1; l >= 0; l--) {
|
||||
const o = t[l];
|
||||
if (i !== o) {
|
||||
if (s !== o) {
|
||||
const c = o.parentNode === e;
|
||||
!s && !l ? (c ? e.replaceChild(i, o) : e.insertBefore(i, n)) : c && o.remove();
|
||||
} else s = !0;
|
||||
!i && !l ? (c ? e.replaceChild(s, o) : e.insertBefore(s, n)) : c && o.remove();
|
||||
} else i = !0;
|
||||
}
|
||||
} else e.insertBefore(i, n);
|
||||
return [i];
|
||||
} else e.insertBefore(s, n);
|
||||
return [s];
|
||||
}
|
||||
var H = ((e) => (
|
||||
(e.START_POMODORO = 'START_POMODORO'), (e.START_FOCUS_MODE = 'START_FOCUS_MODE'), e
|
||||
))(H || {}),
|
||||
le = ((e) => ((e.PLUGIN_MESSAGE = 'PLUGIN_MESSAGE'), e))(le || {});
|
||||
const Oe = [
|
||||
var oe = ((e) => (
|
||||
(e.START_POMODORO = 'START_POMODORO'), (e.START_FOCUS_MODE = 'START_FOCUS_MODE'), e
|
||||
))(oe || {});
|
||||
const Ee = [
|
||||
{
|
||||
id: 'overwhelm',
|
||||
title: 'Overwhelm',
|
||||
|
|
@ -741,108 +740,108 @@ const Oe = [
|
|||
],
|
||||
},
|
||||
];
|
||||
var Ie = k(
|
||||
var Oe = _(
|
||||
`<div class="page-fade info-content"><div class=intro><h2>Understanding Procrastination</h2><p><strong>Procrastination is an emotion regulation problem, not a time management problem.</strong></p></div><section><h3>The Procrastination Cycle</h3><p>When we face tasks that trigger uncomfortable emotions, we enter a feedback loop:</p><div class=procrastination-graph><div class=graph-item>Fear of failure</div><div class=sync-icon>→</div><div class=graph-item>Avoid the task</div><div class=sync-icon>→</div><div class=graph-item>Temporary relief</div><div class=sync-icon>→</div><div class=graph-item>Increased anxiety</div></div></section><section><h3>Breaking the Cycle</h3><p>The key is to approach procrastination with curiosity and compassion, not judgment. Ask yourself:</p><ul><li>What emotions come up when I think about this task?</li><li>What specific aspect feels most challenging?</li><li>What am I afraid might happen if I start?</li></ul></section><section><h3>Practical Strategies</h3><ul><li><strong>Start small:</strong> What's the tiniest first step you could take?</li><li><strong>Time-box:</strong> Work for just 10-25 minutes, then take a break</li><li><strong>Reframe:</strong> Focus on progress over perfection</li><li><strong>Self-compassion:</strong> Speak to yourself as you would to a good friend</li></ul></section><section><h3>Common Triggers</h3><p>Procrastination is often triggered by perfectionism, fear of failure, feeling overwhelmed, unclear expectations, or finding the task boring. Identifying your specific trigger is the first step to moving forward.</p></section><div class=action-buttons><button class=primary-button>Back to work!`,
|
||||
);
|
||||
const Pe = (e) =>
|
||||
const Ie = (e) =>
|
||||
(() => {
|
||||
var t = Ie(),
|
||||
var t = Oe(),
|
||||
n = t.firstChild,
|
||||
r = n.nextSibling,
|
||||
i = r.nextSibling,
|
||||
s = i.nextSibling,
|
||||
l = s.nextSibling,
|
||||
s = r.nextSibling,
|
||||
i = s.nextSibling,
|
||||
l = i.nextSibling,
|
||||
o = l.nextSibling,
|
||||
c = o.firstChild;
|
||||
return Ce(c, 'click', e.onBackToWork), t;
|
||||
return Te(c, 'click', e.onBackToWork), t;
|
||||
})();
|
||||
oe(['click']);
|
||||
var Me = k('<header class="header page-fade"><button class=back-button>← Back'),
|
||||
De = k(
|
||||
re(['click']);
|
||||
var Pe = _('<header class="header page-fade"><button class=back-button>← Back'),
|
||||
Me = _(
|
||||
`<div class="intro page-fade"><h2>What's holding you back?</h2><p class=text-muted>Choose what best matches your current feeling:</p><button class=info-button>Learn about procrastination →`,
|
||||
),
|
||||
Le = k('<div class="blocker-grid page-fade">'),
|
||||
Re = k(
|
||||
De = _('<div class="blocker-grid page-fade">'),
|
||||
Le = _(
|
||||
'<div class="strategy-container page-fade"><div class=selected-type><h2 class=text-primary></h2><p class="emotion text-muted"></p></div><h3>Recommended Strategies:</h3><div class=strategy-list>',
|
||||
),
|
||||
Ne = k('<div class=app><main class=main>'),
|
||||
Be = k(
|
||||
Re = _('<div class=app><main class=main>'),
|
||||
Be = _(
|
||||
'<button class="blocker-card card card-clickable"><h3 class=text-primary></h3><p class=text-muted>',
|
||||
),
|
||||
Ue = k(
|
||||
Ne = _(
|
||||
'<button class=strategy-action-btn title="Start a focus session">🎯 Start focus session',
|
||||
),
|
||||
We = k(
|
||||
We = _(
|
||||
'<div class="strategy-item card"><div class=strategy-content><p class=strategy-text>',
|
||||
);
|
||||
const Fe = () => {
|
||||
const [e, t] = V('home'),
|
||||
[n, r] = V(null),
|
||||
i = (o) => {
|
||||
const Ue = () => {
|
||||
const [e, t] = q('home'),
|
||||
[n, r] = q(null),
|
||||
s = (o) => {
|
||||
r(o), t('strategies');
|
||||
},
|
||||
s = () => {
|
||||
i = () => {
|
||||
t('home'), r(null);
|
||||
},
|
||||
l = (o) => {
|
||||
window.parent.postMessage(
|
||||
{
|
||||
type: le.PLUGIN_MESSAGE,
|
||||
message: { type: o },
|
||||
messageId: Date.now().toString(),
|
||||
},
|
||||
'*',
|
||||
);
|
||||
};
|
||||
l = async (o, c) =>
|
||||
new Promise((u) => {
|
||||
const f = Math.random().toString(36).substr(2, 9),
|
||||
a = (g) => {
|
||||
g.data.messageId === f &&
|
||||
(window.removeEventListener('message', a), u(g.data.response));
|
||||
};
|
||||
window.addEventListener('message', a),
|
||||
window.parent.postMessage({ type: o, payload: c, messageId: f }, '*');
|
||||
});
|
||||
return (() => {
|
||||
var o = Ne(),
|
||||
var o = Re(),
|
||||
c = o.firstChild;
|
||||
return (
|
||||
v(
|
||||
o,
|
||||
x(P, {
|
||||
k(P, {
|
||||
get when() {
|
||||
return e() !== 'home';
|
||||
},
|
||||
get children() {
|
||||
var u = Me(),
|
||||
var u = Pe(),
|
||||
f = u.firstChild;
|
||||
return (f.$$click = s), u;
|
||||
return (f.$$click = i), u;
|
||||
},
|
||||
}),
|
||||
c,
|
||||
),
|
||||
v(
|
||||
c,
|
||||
x(P, {
|
||||
k(P, {
|
||||
get when() {
|
||||
return e() === 'home';
|
||||
},
|
||||
get children() {
|
||||
return [
|
||||
(() => {
|
||||
var u = De(),
|
||||
var u = Me(),
|
||||
f = u.firstChild,
|
||||
a = f.nextSibling,
|
||||
m = a.nextSibling;
|
||||
return (m.$$click = () => t('info')), u;
|
||||
g = a.nextSibling;
|
||||
return (g.$$click = () => t('info')), u;
|
||||
})(),
|
||||
(() => {
|
||||
var u = Le();
|
||||
var u = De();
|
||||
return (
|
||||
v(
|
||||
u,
|
||||
x(J, {
|
||||
each: Oe,
|
||||
k(Y, {
|
||||
each: Ee,
|
||||
children: (f) =>
|
||||
(() => {
|
||||
var a = Be(),
|
||||
m = a.firstChild,
|
||||
g = m.nextSibling;
|
||||
g = a.firstChild,
|
||||
m = g.nextSibling;
|
||||
return (
|
||||
(a.$$click = () => i(f)),
|
||||
v(m, () => f.title),
|
||||
v(g, () => f.emotion),
|
||||
(a.$$click = () => s(f)),
|
||||
v(g, () => f.title),
|
||||
v(m, () => f.emotion),
|
||||
a
|
||||
);
|
||||
})(),
|
||||
|
|
@ -858,35 +857,35 @@ const Fe = () => {
|
|||
),
|
||||
v(
|
||||
c,
|
||||
x(P, {
|
||||
k(P, {
|
||||
get when() {
|
||||
return e() === 'info';
|
||||
},
|
||||
get children() {
|
||||
return x(Pe, { onBackToWork: () => l(H.START_FOCUS_MODE) });
|
||||
return k(Ie, { onBackToWork: () => l(oe.START_FOCUS_MODE) });
|
||||
},
|
||||
}),
|
||||
null,
|
||||
),
|
||||
v(
|
||||
c,
|
||||
x(P, {
|
||||
k(P, {
|
||||
get when() {
|
||||
return ke(() => e() === 'strategies')() && n();
|
||||
},
|
||||
get children() {
|
||||
var u = Re(),
|
||||
var u = Le(),
|
||||
f = u.firstChild,
|
||||
a = f.firstChild,
|
||||
m = a.nextSibling,
|
||||
g = f.nextSibling,
|
||||
$ = g.nextSibling;
|
||||
g = a.nextSibling,
|
||||
m = f.nextSibling,
|
||||
$ = m.nextSibling;
|
||||
return (
|
||||
v(a, () => n().title),
|
||||
v(m, () => n().emotion),
|
||||
v(g, () => n().emotion),
|
||||
v(
|
||||
$,
|
||||
x(J, {
|
||||
k(Y, {
|
||||
get each() {
|
||||
return n().strategies;
|
||||
},
|
||||
|
|
@ -901,11 +900,11 @@ const Fe = () => {
|
|||
v(S, C),
|
||||
v(
|
||||
y,
|
||||
x(P, {
|
||||
k(P, {
|
||||
when: E,
|
||||
get children() {
|
||||
var _ = Ue();
|
||||
return (_.$$click = () => l(H.START_POMODORO)), _;
|
||||
var x = Ne();
|
||||
return (x.$$click = () => l('START_POMODORO')), x;
|
||||
},
|
||||
}),
|
||||
null,
|
||||
|
|
@ -926,6 +925,6 @@ const Fe = () => {
|
|||
);
|
||||
})();
|
||||
};
|
||||
oe(['click']);
|
||||
const z = document.getElementById('root');
|
||||
z && Te(() => x(Fe, {}), z);
|
||||
re(['click']);
|
||||
const Z = document.getElementById('root');
|
||||
Z && Ae(() => k(Ue, {}), Z);
|
||||
|
|
|
|||
|
|
@ -6,9 +6,15 @@
|
|||
"minSupVersion": "13.0.0",
|
||||
"description": "Helps identify procrastination blockers and provides tailored strategies to overcome them",
|
||||
"author": "Super Productivity Community",
|
||||
"homepage": "https://github.com/johannesjo/super-productivity",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/johannesjo/super-productivity.git"
|
||||
},
|
||||
"hooks": ["currentTaskChange"],
|
||||
"permissions": ["showSnack", "openDialog", "addTask", "showIndexHtmlAsView"],
|
||||
"iFrame": true,
|
||||
"sidePanel": true,
|
||||
"isSkipMenuEntry": false,
|
||||
"icon": "icon.svg"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,92 +0,0 @@
|
|||
const o = {
|
||||
ADD_STRATEGY_TASK: 'ADD_STRATEGY_TASK',
|
||||
START_POMODORO: 'START_POMODORO',
|
||||
START_FOCUS_MODE: 'START_FOCUS_MODE',
|
||||
QUICK_ADD_TASK: 'QUICK_ADD_TASK',
|
||||
},
|
||||
t = {
|
||||
SHOW_ADD_TASK_BAR: '[Layout] Show AddTaskBar',
|
||||
SET_CURRENT_TASK: '[Task] SetCurrentTask',
|
||||
START_POMODORO: '[Pomodoro] Start Pomodoro',
|
||||
SHOW_FOCUS_OVERLAY: '[FocusMode] Show Focus Overlay',
|
||||
},
|
||||
e = { SUCCESS: 'SUCCESS', ERROR: 'ERROR', INFO: 'INFO' },
|
||||
c = {
|
||||
PLUGIN_MESSAGE: 'PLUGIN_MESSAGE',
|
||||
PLUGIN_MESSAGE_RESPONSE: 'PLUGIN_MESSAGE_RESPONSE',
|
||||
PLUGIN_MESSAGE_ERROR: 'PLUGIN_MESSAGE_ERROR',
|
||||
},
|
||||
i = async (a) => {
|
||||
switch (a.type) {
|
||||
case o.ADD_STRATEGY_TASK:
|
||||
const S = `Strategy: ${a.strategy}`,
|
||||
s = `Strategy for ${a.blockerType}: ${a.strategy}`;
|
||||
try {
|
||||
const A = await PluginAPI.addTask({ title: S, notes: s });
|
||||
PluginAPI.dispatchAction({ type: t.SHOW_ADD_TASK_BAR }),
|
||||
PluginAPI.dispatchAction({ type: t.SET_CURRENT_TASK, id: A }),
|
||||
PluginAPI.showSnack({
|
||||
msg: 'Strategy task created! You can edit it in the task bar.',
|
||||
type: e.SUCCESS,
|
||||
});
|
||||
} catch (A) {
|
||||
console.error('Failed to create task:', A),
|
||||
PluginAPI.showSnack({ msg: 'Failed to create task', type: e.ERROR });
|
||||
}
|
||||
break;
|
||||
case o.START_POMODORO:
|
||||
PluginAPI.dispatchAction({ type: t.SHOW_FOCUS_OVERLAY }),
|
||||
PluginAPI.showSnack({
|
||||
msg: 'Focus mode activated! Distractions minimized.',
|
||||
type: e.SUCCESS,
|
||||
});
|
||||
break;
|
||||
case o.START_FOCUS_MODE:
|
||||
PluginAPI.dispatchAction({ type: t.SHOW_FOCUS_OVERLAY }),
|
||||
PluginAPI.showSnack({
|
||||
msg: 'Focus mode activated! Distractions minimized.',
|
||||
type: e.SUCCESS,
|
||||
});
|
||||
break;
|
||||
case o.QUICK_ADD_TASK:
|
||||
PluginAPI.dispatchAction({ type: t.SHOW_ADD_TASK_BAR }),
|
||||
PluginAPI.showSnack({
|
||||
msg: 'Add task bar opened. Create your task!',
|
||||
type: e.INFO,
|
||||
});
|
||||
break;
|
||||
default:
|
||||
console.warn('Unknown message type:', a.type);
|
||||
}
|
||||
};
|
||||
PluginAPI.onMessage(i);
|
||||
window.__pluginMessageHandler = i;
|
||||
window.addEventListener('message', async (a) => {
|
||||
var S;
|
||||
if (((S = a.data) == null ? void 0 : S.type) === c.PLUGIN_MESSAGE && a.data.message)
|
||||
try {
|
||||
const s = await i(a.data.message);
|
||||
a.source &&
|
||||
a.data.messageId &&
|
||||
a.source.postMessage(
|
||||
{ type: c.PLUGIN_MESSAGE_RESPONSE, messageId: a.data.messageId, result: s },
|
||||
'*',
|
||||
);
|
||||
} catch (s) {
|
||||
console.error('Error handling iframe message:', s),
|
||||
a.source &&
|
||||
a.data.messageId &&
|
||||
a.source.postMessage(
|
||||
{
|
||||
type: c.PLUGIN_MESSAGE_ERROR,
|
||||
messageId: a.data.messageId,
|
||||
error: s.message,
|
||||
},
|
||||
'*',
|
||||
);
|
||||
}
|
||||
});
|
||||
PluginAPI.showSnack({
|
||||
msg: 'Procrastination Buster loaded successfully!',
|
||||
type: e.SUCCESS,
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue