craft-native 0.0.37 → 0.0.49
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/android/src/index.js +268 -0
- package/dist/android/src/index.js.map +10 -0
- package/dist/android/templates/AndroidManifest.xml.template +69 -0
- package/dist/android/templates/CraftBridge.kt.template +3748 -0
- package/dist/android/templates/CraftBridgeExtensions.kt.template +383 -0
- package/dist/android/templates/CraftWidgetProvider.kt.template +246 -0
- package/dist/android/templates/MainActivity.kt.template +109 -0
- package/dist/android/templates/build.gradle.kts.app.template +80 -0
- package/dist/android/templates/build.gradle.kts.project.template +5 -0
- package/dist/android/templates/fastlane/Appfile +25 -0
- package/dist/android/templates/fastlane/Fastfile +192 -0
- package/dist/android/templates/fastlane/Gemfile +7 -0
- package/dist/android/templates/github-workflow-android.yml +248 -0
- package/dist/android/templates/github-workflow-test.yml +329 -0
- package/dist/android/templates/settings.gradle.kts.template +18 -0
- package/dist/android/templates/test-bridges.html +1463 -0
- package/dist/api/window.d.ts +18 -0
- package/dist/api/window.d.ts.map +1 -1
- package/dist/assets/index.d.ts.map +1 -1
- package/dist/bridge/core.d.ts +2 -0
- package/dist/bridge/core.d.ts.map +1 -1
- package/dist/cli.js +4168 -0
- package/dist/components/sidebar.d.ts +5 -1
- package/dist/components/sidebar.d.ts.map +1 -1
- package/dist/dev/devtools.d.ts +1 -1
- package/dist/dev/devtools.d.ts.map +1 -1
- package/dist/dev/hot-reload.d.ts +12 -3
- package/dist/dev/hot-reload.d.ts.map +1 -1
- package/dist/index.cjs +573 -208
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +585 -216
- package/dist/index.js.map +45 -0
- package/dist/ios/src/index.js +186 -0
- package/dist/ios/src/index.js.map +10 -0
- package/dist/ios/templates/CraftApp.swift +4241 -0
- package/dist/ios/templates/CraftAppExtensions.swift +361 -0
- package/dist/ios/templates/CraftWidget.swift +247 -0
- package/dist/ios/templates/Info.plist.template +65 -0
- package/dist/ios/templates/fastlane/Appfile +45 -0
- package/dist/ios/templates/fastlane/Fastfile +189 -0
- package/dist/ios/templates/fastlane/Gemfile +7 -0
- package/dist/ios/templates/fastlane/Matchfile +58 -0
- package/dist/ios/templates/github-workflow-ios.yml +192 -0
- package/dist/ios/templates/github-workflow-release.yml +175 -0
- package/dist/ios/templates/github-workflow-test.yml +272 -0
- package/dist/ios/templates/project.yml.template +25 -0
- package/dist/ios/templates/test-bridges.html +1463 -0
- package/dist/package.d.ts +106 -2
- package/dist/package.d.ts.map +1 -1
- package/dist/package.test.d.ts +2 -0
- package/dist/package.test.d.ts.map +1 -0
- package/dist/styles/sidebar-templates.d.ts.map +1 -1
- package/dist/styles/sidebars.d.ts +12 -8
- package/dist/styles/sidebars.d.ts.map +1 -1
- package/dist/templates/projects/blank/craft.config.ts +19 -0
- package/dist/templates/projects/blank/index.html +27 -0
- package/dist/templates/projects/blank/package.json +19 -0
- package/dist/templates/projects/blank/src/main.ts +26 -0
- package/dist/templates/projects/dashboard/craft.config.ts +42 -0
- package/dist/templates/projects/dashboard/index.html +13 -0
- package/dist/templates/projects/dashboard/package.json +20 -0
- package/dist/templates/projects/dashboard/src/main.ts +163 -0
- package/dist/templates/projects/dashboard/src/styles.css +280 -0
- package/dist/templates/projects/drawer/craft.config.ts +47 -0
- package/dist/templates/projects/drawer/index.html +13 -0
- package/dist/templates/projects/drawer/package.json +21 -0
- package/dist/templates/projects/drawer/src/main.ts +406 -0
- package/dist/templates/projects/drawer/src/styles.css +468 -0
- package/dist/templates/projects/ecommerce/craft.config.ts +32 -0
- package/dist/templates/projects/ecommerce/index.html +13 -0
- package/dist/templates/projects/ecommerce/package.json +19 -0
- package/dist/templates/projects/ecommerce/src/main.ts +194 -0
- package/dist/templates/projects/ecommerce/src/styles.css +169 -0
- package/dist/templates/projects/social/craft.config.ts +32 -0
- package/dist/templates/projects/social/index.html +13 -0
- package/dist/templates/projects/social/package.json +19 -0
- package/dist/templates/projects/social/src/main.ts +270 -0
- package/dist/templates/projects/social/src/styles.css +216 -0
- package/dist/templates/projects/tabs/craft.config.ts +47 -0
- package/dist/templates/projects/tabs/index.html +13 -0
- package/dist/templates/projects/tabs/package.json +21 -0
- package/dist/templates/projects/tabs/src/main.ts +177 -0
- package/dist/templates/projects/tabs/src/styles.css +163 -0
- package/dist/types.d.ts +29 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/updater/index.d.ts +1 -0
- package/dist/updater/index.d.ts.map +1 -1
- package/package.json +5 -12
- package/bin/cli.ts +0 -937
package/dist/package.d.ts
CHANGED
|
@@ -31,14 +31,49 @@ export interface PackageConfig {
|
|
|
31
31
|
dmg?: boolean;
|
|
32
32
|
/** Create PKG installer */
|
|
33
33
|
pkg?: boolean;
|
|
34
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* Build the PKG as a Mac App Store submission with `productbuild` instead
|
|
36
|
+
* of a plain `pkgbuild` installer. Requires `installerIdentity`, and the
|
|
37
|
+
* app itself must be signed with a `3rd Party Mac Developer Application`
|
|
38
|
+
* identity plus a `.provisionprofile`.
|
|
39
|
+
*/
|
|
40
|
+
appStore?: boolean;
|
|
41
|
+
/** Application code signing identity, e.g. "Developer ID Application: Acme (TEAMID)" */
|
|
35
42
|
signIdentity?: string;
|
|
36
|
-
/**
|
|
43
|
+
/** Installer code signing identity, e.g. "3rd Party Mac Developer Installer: Acme (TEAMID)" */
|
|
44
|
+
installerIdentity?: string;
|
|
45
|
+
/** Path to the entitlements plist applied when signing the app */
|
|
46
|
+
entitlements?: string;
|
|
47
|
+
/** Path to a `.provisionprofile` embedded as `Contents/embedded.provisionprofile` */
|
|
48
|
+
provisioningProfile?: string;
|
|
49
|
+
/** Build number (`CFBundleVersion`). Defaults to `version`. */
|
|
50
|
+
buildNumber?: string;
|
|
51
|
+
/** `LSApplicationCategoryType`, e.g. "public.app-category.utilities" — required by the App Store */
|
|
52
|
+
category?: string;
|
|
53
|
+
/** `LSMinimumSystemVersion`, e.g. "13.0" */
|
|
54
|
+
minimumSystemVersion?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Menu bar app: sets `LSUIElement` so the app has no Dock icon and never
|
|
57
|
+
* appears in the app switcher.
|
|
58
|
+
*/
|
|
59
|
+
menuBarOnly?: boolean;
|
|
60
|
+
/** Notarize the app. Direct distribution only — App Store builds are notarized by Apple. */
|
|
37
61
|
notarize?: boolean;
|
|
38
62
|
/** Apple ID for notarization */
|
|
39
63
|
appleId?: string;
|
|
40
64
|
/** App-specific password */
|
|
41
65
|
applePassword?: string;
|
|
66
|
+
/** Team ID for notarization. Required by `notarytool` alongside `appleId`. */
|
|
67
|
+
teamId?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Extra executables copied into `Contents/MacOS/` beside the app binary.
|
|
70
|
+
*
|
|
71
|
+
* A server-backed app (a Bun program driving a Craft webview, say) spawns a
|
|
72
|
+
* helper at runtime; bundle it here so the installed `.app` is
|
|
73
|
+
* self-contained. Resolve it relative to the running executable — on macOS
|
|
74
|
+
* the helper lands next to `process.execPath`.
|
|
75
|
+
*/
|
|
76
|
+
additionalExecutables?: string[];
|
|
42
77
|
};
|
|
43
78
|
/** Windows-specific options */
|
|
44
79
|
windows?: {
|
|
@@ -46,6 +81,8 @@ export interface PackageConfig {
|
|
|
46
81
|
msi?: boolean;
|
|
47
82
|
/** Create ZIP archive */
|
|
48
83
|
zip?: boolean;
|
|
84
|
+
/** Architecture encoded in MSI metadata (defaults to the native host) */
|
|
85
|
+
architecture?: 'x86' | 'x64' | 'arm64';
|
|
49
86
|
/** Code signing certificate */
|
|
50
87
|
certificatePath?: string;
|
|
51
88
|
/** Certificate password */
|
|
@@ -67,6 +104,16 @@ export interface PackageConfig {
|
|
|
67
104
|
rpmDependencies?: string[];
|
|
68
105
|
};
|
|
69
106
|
}
|
|
107
|
+
interface MSIOptions {
|
|
108
|
+
name: string;
|
|
109
|
+
version: string;
|
|
110
|
+
binaryPath: string;
|
|
111
|
+
outputPath: string;
|
|
112
|
+
manufacturer: string;
|
|
113
|
+
architecture: 'x86' | 'x64' | 'arm64';
|
|
114
|
+
certificatePath?: string;
|
|
115
|
+
certificatePassword?: string;
|
|
116
|
+
}
|
|
70
117
|
export interface PackageResult {
|
|
71
118
|
success: boolean;
|
|
72
119
|
platform: string;
|
|
@@ -74,10 +121,66 @@ export interface PackageResult {
|
|
|
74
121
|
outputPath?: string;
|
|
75
122
|
error?: string;
|
|
76
123
|
}
|
|
124
|
+
export declare function formatPackagingCommandError(tool: string, code: number | null, stdout: string, stderr: string): string;
|
|
77
125
|
/**
|
|
78
126
|
* Package a Craft application for distribution
|
|
79
127
|
*/
|
|
80
128
|
export declare function packageApp(config: PackageConfig): Promise<PackageResult[]>;
|
|
129
|
+
export interface MacOSBundleMetadata {
|
|
130
|
+
name: string;
|
|
131
|
+
version: string;
|
|
132
|
+
bundleId: string;
|
|
133
|
+
/** `CFBundleVersion`. Defaults to `version`. */
|
|
134
|
+
buildNumber?: string;
|
|
135
|
+
/** Basename of the `.icns` inside `Contents/Resources`, without the extension */
|
|
136
|
+
iconName?: string;
|
|
137
|
+
category?: string;
|
|
138
|
+
minimumSystemVersion?: string;
|
|
139
|
+
/** Sets `LSUIElement` — no Dock icon, no app switcher entry */
|
|
140
|
+
menuBarOnly?: boolean;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Render `Contents/Info.plist` for a macOS app bundle.
|
|
144
|
+
*
|
|
145
|
+
* Only the keys that were asked for are emitted, so a plain desktop app does
|
|
146
|
+
* not carry menu-bar or App Store metadata it has no use for.
|
|
147
|
+
*/
|
|
148
|
+
export declare function macOSInfoPlist(metadata: MacOSBundleMetadata): string;
|
|
149
|
+
/**
|
|
150
|
+
* Build the `codesign` argument list for an app bundle.
|
|
151
|
+
*
|
|
152
|
+
* App Store builds are sandboxed and must *not* opt into the hardened runtime;
|
|
153
|
+
* Developer ID builds must, or notarization rejects them.
|
|
154
|
+
*/
|
|
155
|
+
export declare function codesignArguments(opts: {
|
|
156
|
+
path: string;
|
|
157
|
+
identity: string;
|
|
158
|
+
entitlements?: string;
|
|
159
|
+
hardenedRuntime?: boolean;
|
|
160
|
+
}): string[];
|
|
161
|
+
/** Build the `productbuild` argument list for a Mac App Store submission package. */
|
|
162
|
+
export declare function productbuildArguments(opts: {
|
|
163
|
+
appBundlePath: string;
|
|
164
|
+
outputPath: string;
|
|
165
|
+
identity: string;
|
|
166
|
+
}): string[];
|
|
167
|
+
/** Build the `xcrun notarytool submit` argument list for a DMG or PKG. */
|
|
168
|
+
export declare function notarytoolArguments(opts: {
|
|
169
|
+
artifactPath: string;
|
|
170
|
+
appleId: string;
|
|
171
|
+
applePassword: string;
|
|
172
|
+
teamId: string;
|
|
173
|
+
}): string[];
|
|
174
|
+
export declare function dmgCapacityMegabytes(contentBytes: number): number;
|
|
175
|
+
export declare function dmgCreateArguments(opts: {
|
|
176
|
+
appBundlePath: string;
|
|
177
|
+
outputPath: string;
|
|
178
|
+
volumeName: string;
|
|
179
|
+
}, contentBytes: number): string[];
|
|
180
|
+
export declare function shouldRetryHdiutil(error: string, attempt: number, maxAttempts?: number): boolean;
|
|
181
|
+
export declare function windowsArchitecture(architecture: string): 'x86' | 'x64' | 'arm64';
|
|
182
|
+
export declare function renderWixSource(opts: Pick<MSIOptions, 'name' | 'version' | 'manufacturer' | 'architecture'>, sourceName: string): string;
|
|
183
|
+
export declare function windowsExecutableName(name: string): string;
|
|
81
184
|
/**
|
|
82
185
|
* Simple packaging function for quick use
|
|
83
186
|
*/
|
|
@@ -87,4 +190,5 @@ export declare function pack(options: {
|
|
|
87
190
|
binaryPath: string;
|
|
88
191
|
outDir?: string;
|
|
89
192
|
}): Promise<PackageResult[]>;
|
|
193
|
+
export {};
|
|
90
194
|
//# sourceMappingURL=package.d.ts.map
|
package/dist/package.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.d.ts","sourceRoot":"","sources":["../src/package.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
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AAC,CAK3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.test.d.ts","sourceRoot":"","sources":["../src/package.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar-templates.d.ts","sourceRoot":"","sources":["../../src/styles/sidebar-templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAA;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,MAAM,CAAA;IACvC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,eAAe,EAAE,CAAA;IACxB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,kBAAkB,EAAE,CAAA;IAC/B,KAAK,CAAC,EAAE,eAAe,EAAE,CAAA;IACzB,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;IACD,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,eAAe,EAAE,CAAA;KAC1B,CAAA;IACD,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,UAAU,CAAC,E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AE,OAAO,CAAA;CACrB;AAMD,QAAA,MAAM,KAAK;;;;;;;;;;;;;;;;CAgBV,CAAA;AAWD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAsF5D;AAMD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW,EAAE,SAAS,UAAQ,GAAG,MAAM,CAwF7E;AAMD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CA4E/D;AAMD,eAAO,MAAM,aAAa,EAAE,WA+C3B,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,WA6BzB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,WAwB9B,CAAA;AAMD,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,GAAG,UAAU,GAAG,MAAM,CA+ChG;AAMD,QAAA,MAAM,QAAQ,EAAE;IACd,kBAAkB,EAAE,OAAO,kBAAkB,CAAC;IAC9C,gBAAgB,EAAE,OAAO,gBAAgB,CAAC;IAC1C,qBAAqB,EAAE,OAAO,qBAAqB,CAAC;IACpD,aAAa,EAAE,OAAO,aAAa,CAAC;IACpC,WAAW,EAAE,OAAO,WAAW,CAAC;IAChC,gBAAgB,EAAE,OAAO,gBAAgB,CAAC;IAC1C,eAAe,EAAE,OAAO,eAAe,CAAC;IACxC,KAAK,EAAE,OAAO,KAAK,CAAC;CAUrB,CAAC;AACF,eAAe,QAAQ,CAAC"}
|
|
@@ -3,21 +3,22 @@
|
|
|
3
3
|
* CSS/Tailwind-based sidebar implementations
|
|
4
4
|
*
|
|
5
5
|
* Three styles:
|
|
6
|
-
* - Tahoe: macOS
|
|
6
|
+
* - Tahoe: the macOS Tahoe (26/27) source list
|
|
7
7
|
* - Arc: Arc browser vertical tabs style
|
|
8
8
|
* - OrbStack: Dark minimal style
|
|
9
9
|
*
|
|
10
|
+
* For stx apps, prefer `@stacksjs/components`' <Sidebar theme="macos"> —
|
|
11
|
+
* the canonical, behavior-complete implementation these class maps mirror.
|
|
12
|
+
*
|
|
10
13
|
* @module @craft-native/styles/sidebars
|
|
11
14
|
*/
|
|
12
15
|
/**
|
|
13
|
-
* Tahoe sidebar
|
|
16
|
+
* Tahoe sidebar — the macOS Tahoe (26/27 "Liquid Glass") source list.
|
|
14
17
|
*
|
|
15
|
-
*
|
|
16
|
-
* -
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* - Section headers in small caps
|
|
20
|
-
* - SF Symbol-style icons
|
|
18
|
+
* Metrics measured from native Mail/Music/Notes at @2x:
|
|
19
|
+
* 30px rows + 2px gap, 9px-radius quaternary-fill highlight, 17px icons,
|
|
20
|
+
* 13px labels, plain gray tabular counts, 11px semibold section headers.
|
|
21
|
+
* Selection is a translucent gray fill — never an accent-colored pill.
|
|
21
22
|
*/
|
|
22
23
|
export declare const tahoeStyles: {
|
|
23
24
|
sidebar: string;
|
|
@@ -28,8 +29,11 @@ export declare const tahoeStyles: {
|
|
|
28
29
|
collapseChevron: string;
|
|
29
30
|
item: string;
|
|
30
31
|
itemSelected: string;
|
|
32
|
+
disclosure: string;
|
|
33
|
+
disclosureChevron: string;
|
|
31
34
|
itemIcon: string;
|
|
32
35
|
itemIconSelected: string;
|
|
36
|
+
itemIconSlot: string;
|
|
33
37
|
itemLabel: string;
|
|
34
38
|
itemBadge: string;
|
|
35
39
|
itemBadgeSelected: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebars.d.ts","sourceRoot":"","sources":["../../src/styles/sidebars.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sidebars.d.ts","sourceRoot":"","sources":["../../src/styles/sidebars.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwKvB,CAAA;AAMD;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4MrB,CAAA;AAMD;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8N1B,CAAA;AAMD;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;CA0BxB,CAAA;AAMD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,gsCAkC/B,CAAA;AAMD;;GAEG;AACH,wBAAgB,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,KAAK,CAAC,EAAE,GAAG,MAAM,CAE5E;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,KAAK,GAAG,UAAU,GAAG,OAAO,WAAW,GAAG,OAAO,SAAS,GAAG,OAAO,cAAc,CAWjI;AAMD,QAAA,MAAM,QAAQ,EAAE;IACd,KAAK,EAAE,OAAO,WAAW,CAAC;IAC1B,GAAG,EAAE,OAAO,SAAS,CAAC;IACtB,QAAQ,EAAE,OAAO,cAAc,CAAC;IAChC,KAAK,EAAE,OAAO,YAAY,CAAC;IAC3B,YAAY,EAAE,OAAO,mBAAmB,CAAC;IACzC,EAAE,EAAE,OAAO,EAAE,CAAC;IACd,eAAe,EAAE,OAAO,eAAe,CAAC;CASzC,CAAC;AACF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CraftAppConfig } from 'craft-native'
|
|
2
|
+
|
|
3
|
+
const config: CraftAppConfig = {
|
|
4
|
+
name: '{{APP_NAME}}',
|
|
5
|
+
version: '1.0.0',
|
|
6
|
+
identifier: '{{BUNDLE_ID}}',
|
|
7
|
+
|
|
8
|
+
window: {
|
|
9
|
+
title: '{{APP_NAME}}',
|
|
10
|
+
width: 800,
|
|
11
|
+
height: 600,
|
|
12
|
+
resizable: true,
|
|
13
|
+
center: true
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
entry: './index.html'
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default config
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
|
|
6
|
+
<title>{{APP_NAME}}</title>
|
|
7
|
+
<style>
|
|
8
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
9
|
+
body {
|
|
10
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
11
|
+
background: var(--bg, #ffffff);
|
|
12
|
+
color: var(--text, #1a1a1a);
|
|
13
|
+
min-height: 100vh;
|
|
14
|
+
}
|
|
15
|
+
@media (prefers-color-scheme: dark) {
|
|
16
|
+
:root {
|
|
17
|
+
--bg: #1a1a1a;
|
|
18
|
+
--text: #ffffff;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
</style>
|
|
22
|
+
</head>
|
|
23
|
+
<body>
|
|
24
|
+
<div id="app"></div>
|
|
25
|
+
<script type="module" src="./src/main.ts"></script>
|
|
26
|
+
</body>
|
|
27
|
+
</html>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{APP_NAME_SLUG}}",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "craft dev",
|
|
8
|
+
"build": "craft build",
|
|
9
|
+
"build:release": "craft build --release",
|
|
10
|
+
"ios": "craft ios build && craft ios open",
|
|
11
|
+
"android": "craft android build && craft android open"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"craft-native": "workspace:*"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"typescript": "^5.3.0"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* {{APP_NAME}} - Built with Craft
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { getPlatform, isDesktop, isMobile } from 'craft-native'
|
|
6
|
+
|
|
7
|
+
// Initialize app
|
|
8
|
+
function init() {
|
|
9
|
+
const app = document.getElementById('app')!
|
|
10
|
+
|
|
11
|
+
app.innerHTML = `
|
|
12
|
+
<div style="display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 2rem;">
|
|
13
|
+
<h1 style="font-size: 2.5rem; margin-bottom: 1rem;">{{APP_NAME}}</h1>
|
|
14
|
+
<p style="opacity: 0.7; margin-bottom: 2rem;">Built with Craft</p>
|
|
15
|
+
<p style="font-size: 0.875rem; opacity: 0.5;">Running on ${getPlatform()}</p>
|
|
16
|
+
</div>
|
|
17
|
+
`
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Start app
|
|
21
|
+
if (document.readyState === 'loading') {
|
|
22
|
+
document.addEventListener('DOMContentLoaded', init)
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
init()
|
|
26
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { CraftAppConfig } from 'craft-native'
|
|
2
|
+
|
|
3
|
+
const config: CraftAppConfig = {
|
|
4
|
+
name: '{{APP_NAME}}',
|
|
5
|
+
version: '1.0.0',
|
|
6
|
+
identifier: '{{BUNDLE_ID}}',
|
|
7
|
+
|
|
8
|
+
window: {
|
|
9
|
+
title: '{{APP_NAME}}',
|
|
10
|
+
width: 1280,
|
|
11
|
+
height: 800,
|
|
12
|
+
minWidth: 800,
|
|
13
|
+
minHeight: 600,
|
|
14
|
+
resizable: true,
|
|
15
|
+
center: true
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
entry: './index.html',
|
|
19
|
+
|
|
20
|
+
macos: {
|
|
21
|
+
bundleId: '{{BUNDLE_ID}}',
|
|
22
|
+
appName: '{{APP_NAME}}',
|
|
23
|
+
version: '1.0.0',
|
|
24
|
+
buildNumber: '1',
|
|
25
|
+
minimumSystemVersion: '12.0',
|
|
26
|
+
category: 'public.app-category.business',
|
|
27
|
+
sandbox: true,
|
|
28
|
+
entitlements: {},
|
|
29
|
+
infoPlist: {}
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
windows: {
|
|
33
|
+
appId: '{{APP_NAME}}',
|
|
34
|
+
publisher: 'CN={{AUTHOR}}',
|
|
35
|
+
displayName: '{{APP_NAME}}',
|
|
36
|
+
version: '1.0.0.0',
|
|
37
|
+
minWindowsVersion: '10.0.17763.0',
|
|
38
|
+
capabilities: ['internetClient']
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default config
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>{{APP_NAME}}</title>
|
|
7
|
+
<link rel="stylesheet" href="./src/styles.css">
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="./src/main.ts"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{APP_NAME_SLUG}}",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "craft dev",
|
|
8
|
+
"build": "craft build",
|
|
9
|
+
"build:release": "craft build --release",
|
|
10
|
+
"build:macos": "craft build --platform macos --release",
|
|
11
|
+
"build:windows": "craft build --platform windows --release",
|
|
12
|
+
"build:linux": "craft build --platform linux --release"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"craft-native": "workspace:*"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"typescript": "^5.3.0"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* {{APP_NAME}} - Dashboard Template
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { getPlatform, isDesktop } from 'craft-native'
|
|
6
|
+
|
|
7
|
+
interface NavItem {
|
|
8
|
+
id: string
|
|
9
|
+
label: string
|
|
10
|
+
icon: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface StatCard {
|
|
14
|
+
title: string
|
|
15
|
+
value: string
|
|
16
|
+
change: string
|
|
17
|
+
positive: boolean
|
|
18
|
+
icon: string
|
|
19
|
+
color: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface TableRow {
|
|
23
|
+
id: string
|
|
24
|
+
name: string
|
|
25
|
+
email: string
|
|
26
|
+
status: 'active' | 'pending' | 'inactive'
|
|
27
|
+
date: string
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const navItems: NavItem[] = [
|
|
31
|
+
{ id: 'dashboard', label: 'Dashboard', icon: '<path d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"/>' },
|
|
32
|
+
{ id: 'analytics', label: 'Analytics', icon: '<path d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"/>' },
|
|
33
|
+
{ id: 'users', label: 'Users', icon: '<path d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"/>' },
|
|
34
|
+
{ id: 'settings', label: 'Settings', icon: '<path d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"/><path d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/>' }
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
const stats: StatCard[] = [
|
|
38
|
+
{ title: 'Total Revenue', value: '$45,231', change: '+20.1%', positive: true, icon: '💰', color: '#10b981' },
|
|
39
|
+
{ title: 'Active Users', value: '2,350', change: '+15.3%', positive: true, icon: '👥', color: '#6366f1' },
|
|
40
|
+
{ title: 'Pending Orders', value: '12', change: '-4.5%', positive: false, icon: '📦', color: '#f59e0b' },
|
|
41
|
+
{ title: 'Conversion Rate', value: '3.2%', change: '+2.4%', positive: true, icon: '📈', color: '#ec4899' }
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
const recentUsers: TableRow[] = [
|
|
45
|
+
{ id: '1', name: 'John Doe', email: 'john@example.com', status: 'active', date: '2024-01-15' },
|
|
46
|
+
{ id: '2', name: 'Jane Smith', email: 'jane@example.com', status: 'pending', date: '2024-01-14' },
|
|
47
|
+
{ id: '3', name: 'Bob Johnson', email: 'bob@example.com', status: 'active', date: '2024-01-13' },
|
|
48
|
+
{ id: '4', name: 'Alice Brown', email: 'alice@example.com', status: 'inactive', date: '2024-01-12' },
|
|
49
|
+
{ id: '5', name: 'Charlie Wilson', email: 'charlie@example.com', status: 'active', date: '2024-01-11' }
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
let activeNav = 'dashboard'
|
|
53
|
+
|
|
54
|
+
function renderIcon(path: string): string {
|
|
55
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">${path}</svg>`
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function getStatusBadge(status: string): string {
|
|
59
|
+
const classes: Record<string, string> = {
|
|
60
|
+
active: 'badge badge-success',
|
|
61
|
+
pending: 'badge badge-warning',
|
|
62
|
+
inactive: 'badge badge-danger'
|
|
63
|
+
}
|
|
64
|
+
return `<span class="${classes[status] || 'badge'}">${status}</span>`
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function init(): void {
|
|
68
|
+
const app = document.getElementById('app')!
|
|
69
|
+
|
|
70
|
+
app.innerHTML = `
|
|
71
|
+
<div class="app-layout">
|
|
72
|
+
<aside class="sidebar">
|
|
73
|
+
<div class="sidebar-header">
|
|
74
|
+
<h1>{{APP_NAME}}</h1>
|
|
75
|
+
</div>
|
|
76
|
+
<nav>
|
|
77
|
+
${navItems.map(item => `
|
|
78
|
+
<button class="nav-item ${item.id === activeNav ? 'active' : ''}" data-nav="${item.id}">
|
|
79
|
+
${renderIcon(item.icon)}
|
|
80
|
+
<span>${item.label}</span>
|
|
81
|
+
</button>
|
|
82
|
+
`).join('')}
|
|
83
|
+
</nav>
|
|
84
|
+
</aside>
|
|
85
|
+
|
|
86
|
+
<main class="main-content">
|
|
87
|
+
<div class="page-header">
|
|
88
|
+
<h2>Dashboard</h2>
|
|
89
|
+
<button class="btn btn-primary">
|
|
90
|
+
<span>+ Add New</span>
|
|
91
|
+
</button>
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
<div class="stats-grid">
|
|
95
|
+
${stats.map(stat => `
|
|
96
|
+
<div class="stat-card">
|
|
97
|
+
<div class="stat-card-header">
|
|
98
|
+
<span class="stat-card-title">${stat.title}</span>
|
|
99
|
+
<div class="stat-card-icon" style="background: ${stat.color}20; color: ${stat.color};">
|
|
100
|
+
${stat.icon}
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
<div class="stat-card-value">${stat.value}</div>
|
|
104
|
+
<div class="stat-card-change ${stat.positive ? 'positive' : 'negative'}">
|
|
105
|
+
${stat.positive ? '↑' : '↓'} ${stat.change} from last month
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
`).join('')}
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
<div class="card">
|
|
112
|
+
<div class="card-header">
|
|
113
|
+
<span class="card-title">Recent Users</span>
|
|
114
|
+
<button class="btn btn-primary">View All</button>
|
|
115
|
+
</div>
|
|
116
|
+
<div class="card-body" style="padding: 0;">
|
|
117
|
+
<table class="table">
|
|
118
|
+
<thead>
|
|
119
|
+
<tr>
|
|
120
|
+
<th>Name</th>
|
|
121
|
+
<th>Email</th>
|
|
122
|
+
<th>Status</th>
|
|
123
|
+
<th>Date</th>
|
|
124
|
+
</tr>
|
|
125
|
+
</thead>
|
|
126
|
+
<tbody>
|
|
127
|
+
${recentUsers.map(user => `
|
|
128
|
+
<tr>
|
|
129
|
+
<td>${user.name}</td>
|
|
130
|
+
<td>${user.email}</td>
|
|
131
|
+
<td>${getStatusBadge(user.status)}</td>
|
|
132
|
+
<td>${user.date}</td>
|
|
133
|
+
</tr>
|
|
134
|
+
`).join('')}
|
|
135
|
+
</tbody>
|
|
136
|
+
</table>
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
</main>
|
|
140
|
+
</div>
|
|
141
|
+
`
|
|
142
|
+
|
|
143
|
+
// Navigation click handlers
|
|
144
|
+
document.querySelectorAll('.nav-item').forEach(item => {
|
|
145
|
+
item.addEventListener('click', () => {
|
|
146
|
+
const navId = item.getAttribute('data-nav')
|
|
147
|
+
if (navId) {
|
|
148
|
+
activeNav = navId
|
|
149
|
+
document.querySelectorAll('.nav-item').forEach(i => {
|
|
150
|
+
i.classList.toggle('active', i.getAttribute('data-nav') === navId)
|
|
151
|
+
})
|
|
152
|
+
}
|
|
153
|
+
})
|
|
154
|
+
})
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Start app
|
|
158
|
+
if (document.readyState === 'loading') {
|
|
159
|
+
document.addEventListener('DOMContentLoaded', init)
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
init()
|
|
163
|
+
}
|