@linktr.ee/linkapp 0.0.10 → 0.0.11
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/dev-server/classic/main.tsx +45 -24
- package/dev-server/classic.html +58 -0
- package/dev-server/featured/main.tsx +45 -24
- package/dev-server/featured.html +58 -0
- package/dev-server/preview/Preview.tsx +425 -14
- package/dist/cli.js +9 -3
- package/dist/cli.js.map +1 -1
- package/dist/commands/add.js +3 -3
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +10 -4
- package/dist/commands/deploy.js.map +1 -1
- package/dist/components/ThemeStyle.d.ts +30 -0
- package/dist/components/ThemeStyle.d.ts.map +1 -0
- package/dist/components/ThemeStyle.js +33 -0
- package/dist/components/ThemeStyle.js.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -0
- package/dist/lib/build/detect-layouts.d.ts.map +1 -1
- package/dist/lib/build/detect-layouts.js +1 -4
- package/dist/lib/build/detect-layouts.js.map +1 -1
- package/dist/lib/deploy/generate-manifest-files.d.ts.map +1 -1
- package/dist/lib/deploy/generate-manifest-files.js +6 -0
- package/dist/lib/deploy/generate-manifest-files.js.map +1 -1
- package/dist/lib/deploy/pack-project.d.ts.map +1 -1
- package/dist/lib/deploy/pack-project.js +32 -5
- package/dist/lib/deploy/pack-project.js.map +1 -1
- package/dist/lib/deploy/upload.d.ts +1 -0
- package/dist/lib/deploy/upload.d.ts.map +1 -1
- package/dist/lib/deploy/upload.js +12 -2
- package/dist/lib/deploy/upload.js.map +1 -1
- package/dist/lib/deploy/validation.d.ts.map +1 -1
- package/dist/lib/deploy/validation.js +4 -61
- package/dist/lib/deploy/validation.js.map +1 -1
- package/dist/lib/utils/setup-runtime.d.ts.map +1 -1
- package/dist/lib/utils/setup-runtime.js +48 -17
- package/dist/lib/utils/setup-runtime.js.map +1 -1
- package/dist/schema/config.schema.d.ts +50 -114
- package/dist/schema/config.schema.d.ts.map +1 -1
- package/dist/schema/config.schema.js +94 -18
- package/dist/schema/config.schema.js.map +1 -1
- package/dist/sdk/index.d.ts +21 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/index.js +21 -0
- package/dist/sdk/index.js.map +1 -0
- package/dist/sdk/send-message.d.ts +16 -0
- package/dist/sdk/send-message.d.ts.map +1 -0
- package/dist/sdk/send-message.js +34 -0
- package/dist/sdk/send-message.js.map +1 -0
- package/dist/sdk/use-open-popup.d.ts +23 -0
- package/dist/sdk/use-open-popup.d.ts.map +1 -0
- package/dist/sdk/use-open-popup.js +29 -0
- package/dist/sdk/use-open-popup.js.map +1 -0
- package/dist/types.d.ts +149 -31
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +37 -1
- package/dist/types.js.map +1 -1
- package/package.json +11 -3
- package/runtime/index.html +58 -0
|
@@ -1,41 +1,62 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
1
|
+
import Classic from "@/app/classic";
|
|
2
|
+
import { StrictMode } from "react";
|
|
3
|
+
import { createRoot } from "react-dom/client";
|
|
4
|
+
import "@/app/globals.css";
|
|
5
|
+
|
|
6
|
+
// Conditionally import Layout if it exists
|
|
7
|
+
const layoutModules = import.meta.glob("@/app/layout.{ts,tsx}", {
|
|
8
|
+
eager: true,
|
|
9
|
+
});
|
|
10
|
+
const Layout = Object.values(layoutModules)[0]?.default as
|
|
11
|
+
| React.ComponentType<{ children: React.ReactNode; theme?: any }>
|
|
12
|
+
| undefined;
|
|
6
13
|
|
|
7
14
|
// Preview props injected by dev server via Vite define
|
|
8
|
-
declare const __PREVIEW_PROPS__: Record<string, unknown
|
|
15
|
+
declare const __PREVIEW_PROPS__: Record<string, unknown>;
|
|
9
16
|
|
|
10
17
|
const previewProps = __PREVIEW_PROPS__ || {
|
|
11
|
-
linkUrl:
|
|
18
|
+
linkUrl: "https://example.com/demo",
|
|
12
19
|
theme: {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
cssVariables: {
|
|
21
|
+
"--button-style-text": "#000000",
|
|
22
|
+
"--button-style-background": "#ffffff",
|
|
23
|
+
"--button-style-inner-radius": "12px",
|
|
24
|
+
"--button-style-border-color": "#e5e7eb",
|
|
25
|
+
"--button-style-background-hover": "#f3f4f6",
|
|
26
|
+
"--button-style-contrast-color": "#ffffff",
|
|
27
|
+
"--profileBackground": "#ffffff",
|
|
28
|
+
},
|
|
29
|
+
// Legacy properties (deprecated)
|
|
30
|
+
textColor: "#000000",
|
|
31
|
+
backgroundColor: "#ffffff",
|
|
32
|
+
borderRadius: "12px",
|
|
33
|
+
borderColor: "#e5e7eb",
|
|
34
|
+
backgroundHover: "#f3f4f6",
|
|
35
|
+
contrastColor: "#ffffff",
|
|
36
|
+
textHoverColor: "#111827",
|
|
20
37
|
},
|
|
21
|
-
locale:
|
|
22
|
-
currency:
|
|
23
|
-
username:
|
|
38
|
+
locale: "en-US",
|
|
39
|
+
currency: "USD",
|
|
40
|
+
username: "demo-user",
|
|
24
41
|
viewport: {
|
|
25
42
|
width: 680,
|
|
26
43
|
height: 800,
|
|
27
44
|
},
|
|
28
|
-
}
|
|
45
|
+
};
|
|
29
46
|
|
|
30
|
-
const rootElement = document.getElementById(
|
|
47
|
+
const rootElement = document.getElementById("root");
|
|
31
48
|
if (!rootElement) {
|
|
32
|
-
throw new Error(
|
|
49
|
+
throw new Error("Root element not found");
|
|
33
50
|
}
|
|
34
51
|
|
|
35
52
|
createRoot(rootElement).render(
|
|
36
53
|
<StrictMode>
|
|
37
|
-
|
|
54
|
+
{Layout ? (
|
|
55
|
+
<Layout theme={previewProps.theme}>
|
|
56
|
+
<Classic {...previewProps} />
|
|
57
|
+
</Layout>
|
|
58
|
+
) : (
|
|
38
59
|
<Classic {...previewProps} />
|
|
39
|
-
|
|
40
|
-
</StrictMode
|
|
41
|
-
)
|
|
60
|
+
)}
|
|
61
|
+
</StrictMode>,
|
|
62
|
+
);
|
package/dev-server/classic.html
CHANGED
|
@@ -4,6 +4,64 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Classic - LinkApp</title>
|
|
7
|
+
|
|
8
|
+
<!-- Linktree theme variables will be injected here -->
|
|
9
|
+
<style id="linktree-theme"></style>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
/**
|
|
13
|
+
* Helper function to convert CSS variables object to CSS string
|
|
14
|
+
* @param {Record<string, string>} vars - Object with CSS variable names as keys
|
|
15
|
+
* @returns {string} CSS string like "--var1: value1; --var2: value2;"
|
|
16
|
+
*/
|
|
17
|
+
function renderCssVariables(vars) {
|
|
18
|
+
return Object.entries(vars)
|
|
19
|
+
.map((entry) => entry.join(': '))
|
|
20
|
+
.join('; ') + ';'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Listen for theme updates from parent window
|
|
25
|
+
* Applies CSS variables to the document root
|
|
26
|
+
*/
|
|
27
|
+
window.addEventListener('message', function(event) {
|
|
28
|
+
// Only process messages with the correct structure
|
|
29
|
+
if (
|
|
30
|
+
event.data &&
|
|
31
|
+
typeof event.data === 'object' &&
|
|
32
|
+
event.data.type === 'THEME_UPDATE'
|
|
33
|
+
) {
|
|
34
|
+
const themeUpdate = event.data
|
|
35
|
+
|
|
36
|
+
// Get the style element where theme variables are injected
|
|
37
|
+
const themeStyle = document.getElementById('linktree-theme')
|
|
38
|
+
|
|
39
|
+
if (!themeStyle) {
|
|
40
|
+
console.warn('linktree-theme style element not found')
|
|
41
|
+
return
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Inject CSS variables into :root
|
|
45
|
+
themeStyle.textContent = ':root { ' + renderCssVariables(themeUpdate.payload.variables) + ' }'
|
|
46
|
+
|
|
47
|
+
// Remove any existing theme classes
|
|
48
|
+
const classesToRemove = []
|
|
49
|
+
document.documentElement.classList.forEach((className) => {
|
|
50
|
+
if (className.startsWith('linktree-theme-')) {
|
|
51
|
+
classesToRemove.push(className)
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
classesToRemove.forEach((className) => {
|
|
55
|
+
document.documentElement.classList.remove(className)
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
// Add theme class for additional styling hooks
|
|
59
|
+
if (themeUpdate.payload.name && themeUpdate.payload.name !== 'legacy') {
|
|
60
|
+
document.documentElement.classList.add('linktree-theme-' + themeUpdate.payload.name)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}, false)
|
|
64
|
+
</script>
|
|
7
65
|
</head>
|
|
8
66
|
<body>
|
|
9
67
|
<div id="root"></div>
|
|
@@ -1,41 +1,62 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
1
|
+
import Featured from "@/app/featured";
|
|
2
|
+
import { StrictMode } from "react";
|
|
3
|
+
import { createRoot } from "react-dom/client";
|
|
4
|
+
import "@/app/globals.css";
|
|
5
|
+
|
|
6
|
+
// Conditionally import Layout if it exists
|
|
7
|
+
const layoutModules = import.meta.glob("@/app/layout.{ts,tsx}", {
|
|
8
|
+
eager: true,
|
|
9
|
+
});
|
|
10
|
+
const Layout = Object.values(layoutModules)[0]?.default as
|
|
11
|
+
| React.ComponentType<{ children: React.ReactNode; theme?: any }>
|
|
12
|
+
| undefined;
|
|
6
13
|
|
|
7
14
|
// Preview props injected by dev server via Vite define
|
|
8
|
-
declare const __PREVIEW_PROPS__: Record<string, unknown
|
|
15
|
+
declare const __PREVIEW_PROPS__: Record<string, unknown>;
|
|
9
16
|
|
|
10
17
|
const previewProps = __PREVIEW_PROPS__ || {
|
|
11
|
-
linkUrl:
|
|
18
|
+
linkUrl: "https://example.com/demo",
|
|
12
19
|
theme: {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
cssVariables: {
|
|
21
|
+
"--button-style-text": "#000000",
|
|
22
|
+
"--button-style-background": "#ffffff",
|
|
23
|
+
"--button-style-inner-radius": "12px",
|
|
24
|
+
"--button-style-border-color": "#e5e7eb",
|
|
25
|
+
"--button-style-background-hover": "#f3f4f6",
|
|
26
|
+
"--button-style-contrast-color": "#ffffff",
|
|
27
|
+
"--profileBackground": "#ffffff",
|
|
28
|
+
},
|
|
29
|
+
// Legacy properties (deprecated)
|
|
30
|
+
textColor: "#000000",
|
|
31
|
+
backgroundColor: "#ffffff",
|
|
32
|
+
borderRadius: "12px",
|
|
33
|
+
borderColor: "#e5e7eb",
|
|
34
|
+
backgroundHover: "#f3f4f6",
|
|
35
|
+
contrastColor: "#ffffff",
|
|
36
|
+
textHoverColor: "#111827",
|
|
20
37
|
},
|
|
21
|
-
locale:
|
|
22
|
-
currency:
|
|
23
|
-
username:
|
|
38
|
+
locale: "en-US",
|
|
39
|
+
currency: "USD",
|
|
40
|
+
username: "demo-user",
|
|
24
41
|
viewport: {
|
|
25
42
|
width: 680,
|
|
26
43
|
height: 800,
|
|
27
44
|
},
|
|
28
|
-
}
|
|
45
|
+
};
|
|
29
46
|
|
|
30
|
-
const rootElement = document.getElementById(
|
|
47
|
+
const rootElement = document.getElementById("root");
|
|
31
48
|
if (!rootElement) {
|
|
32
|
-
throw new Error(
|
|
49
|
+
throw new Error("Root element not found");
|
|
33
50
|
}
|
|
34
51
|
|
|
35
52
|
createRoot(rootElement).render(
|
|
36
53
|
<StrictMode>
|
|
37
|
-
|
|
54
|
+
{Layout ? (
|
|
55
|
+
<Layout theme={previewProps.theme}>
|
|
56
|
+
<Featured {...previewProps} />
|
|
57
|
+
</Layout>
|
|
58
|
+
) : (
|
|
38
59
|
<Featured {...previewProps} />
|
|
39
|
-
|
|
40
|
-
</StrictMode
|
|
41
|
-
)
|
|
60
|
+
)}
|
|
61
|
+
</StrictMode>,
|
|
62
|
+
);
|
package/dev-server/featured.html
CHANGED
|
@@ -4,6 +4,64 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Featured - LinkApp</title>
|
|
7
|
+
|
|
8
|
+
<!-- Linktree theme variables will be injected here -->
|
|
9
|
+
<style id="linktree-theme"></style>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
/**
|
|
13
|
+
* Helper function to convert CSS variables object to CSS string
|
|
14
|
+
* @param {Record<string, string>} vars - Object with CSS variable names as keys
|
|
15
|
+
* @returns {string} CSS string like "--var1: value1; --var2: value2;"
|
|
16
|
+
*/
|
|
17
|
+
function renderCssVariables(vars) {
|
|
18
|
+
return Object.entries(vars)
|
|
19
|
+
.map((entry) => entry.join(': '))
|
|
20
|
+
.join('; ') + ';'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Listen for theme updates from parent window
|
|
25
|
+
* Applies CSS variables to the document root
|
|
26
|
+
*/
|
|
27
|
+
window.addEventListener('message', function(event) {
|
|
28
|
+
// Only process messages with the correct structure
|
|
29
|
+
if (
|
|
30
|
+
event.data &&
|
|
31
|
+
typeof event.data === 'object' &&
|
|
32
|
+
event.data.type === 'THEME_UPDATE'
|
|
33
|
+
) {
|
|
34
|
+
const themeUpdate = event.data
|
|
35
|
+
|
|
36
|
+
// Get the style element where theme variables are injected
|
|
37
|
+
const themeStyle = document.getElementById('linktree-theme')
|
|
38
|
+
|
|
39
|
+
if (!themeStyle) {
|
|
40
|
+
console.warn('linktree-theme style element not found')
|
|
41
|
+
return
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Inject CSS variables into :root
|
|
45
|
+
themeStyle.textContent = ':root { ' + renderCssVariables(themeUpdate.payload.variables) + ' }'
|
|
46
|
+
|
|
47
|
+
// Remove any existing theme classes
|
|
48
|
+
const classesToRemove = []
|
|
49
|
+
document.documentElement.classList.forEach((className) => {
|
|
50
|
+
if (className.startsWith('linktree-theme-')) {
|
|
51
|
+
classesToRemove.push(className)
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
classesToRemove.forEach((className) => {
|
|
55
|
+
document.documentElement.classList.remove(className)
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
// Add theme class for additional styling hooks
|
|
59
|
+
if (themeUpdate.payload.name && themeUpdate.payload.name !== 'legacy') {
|
|
60
|
+
document.documentElement.classList.add('linktree-theme-' + themeUpdate.payload.name)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}, false)
|
|
64
|
+
</script>
|
|
7
65
|
</head>
|
|
8
66
|
<body>
|
|
9
67
|
<div id="root"></div>
|