create-disposabl-app 0.14.18 → 0.16.0

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.
Files changed (97) hide show
  1. package/README.md +15 -1
  2. package/dist/disposabl.js +357 -50
  3. package/dist/index.js +8973 -154
  4. package/dist/templates/default/.github/scripts/macos-release.sh +81 -0
  5. package/dist/templates/default/.github/scripts/platforms.sh +1 -1
  6. package/dist/templates/default/.github/scripts/release.sh +1 -1
  7. package/dist/templates/default/.github/workflows/pipeline.yml +14 -3
  8. package/dist/templates/default/apps/desktop/README.md +13 -2
  9. package/dist/templates/default/apps/desktop/forge.config.mts +9 -3
  10. package/dist/templates/default/apps/docs/content/getting-started.mdx +1 -1
  11. package/dist/templates/default/apps/mobile/package.json +1 -0
  12. package/dist/templates/default/apps/web/eslint.config.ts +5 -1
  13. package/dist/templates/default/apps/web/public/disposabl-logo-light.svg +8 -0
  14. package/dist/templates/default/apps/web/public/landing/coast.jpg +0 -0
  15. package/dist/templates/default/apps/web/public/landing/community.jpg +0 -0
  16. package/dist/templates/default/apps/web/public/landing/stores/app-store.svg +46 -0
  17. package/dist/templates/default/apps/web/public/landing/stores/google-play.png +0 -0
  18. package/dist/templates/default/apps/web/public/landing/taste/LICENSE +21 -0
  19. package/dist/templates/default/apps/web/public/landing/taste/init.js +3 -0
  20. package/dist/templates/default/apps/web/public/landing/taste/moments/lib.js +189 -0
  21. package/dist/templates/default/apps/web/public/landing/taste/moments/moments.js +109 -0
  22. package/dist/templates/default/apps/web/public/landing/taste/moments/word-highlight/moment.css +8 -0
  23. package/dist/templates/default/apps/web/public/landing/taste/moments/word-highlight/moment.js +35 -0
  24. package/dist/templates/default/apps/web/public/landing/taste/motion/motion.css +321 -0
  25. package/dist/templates/default/apps/web/public/landing/taste/motion/motion.js +406 -0
  26. package/dist/templates/default/apps/web/routes.config.ts +14 -0
  27. package/dist/templates/default/apps/web/src/router/__root.tsx +8 -2
  28. package/dist/templates/default/apps/web/tsr.config.json +1 -1
  29. package/dist/templates/default/apps/web/vite.config.ts +10 -2
  30. package/dist/templates/default/bun.lock +6 -0
  31. package/dist/templates/default/bunfig.toml +1 -0
  32. package/dist/templates/default/disposabl.json +1 -1
  33. package/dist/templates/default/packages/backend/convex/authSetup.ts +2 -5
  34. package/dist/templates/default/packages/backend/convex/billing.ts +5 -0
  35. package/dist/templates/default/packages/backend/convex/billingHandoff.ts +6 -0
  36. package/dist/templates/default/packages/backend/convex/convex.config.ts +8 -0
  37. package/dist/templates/default/packages/backend/convex/http.ts +6 -0
  38. package/dist/templates/default/packages/backend/convex/revenuecat.ts +13 -0
  39. package/dist/templates/default/packages/backend/convex/schema.ts +44 -0
  40. package/dist/templates/default/packages/backend/convex/telemetry.ts +41 -5
  41. package/dist/templates/default/packages/backend/generate.ts +6 -0
  42. package/dist/templates/default/packages/cli/auth.ts +36 -3
  43. package/dist/templates/default/packages/cli/build.ts +6 -0
  44. package/dist/templates/default/packages/cli/client.ts +189 -19
  45. package/dist/templates/default/packages/cli/errors.ts +18 -0
  46. package/dist/templates/default/packages/cli/telemetry-build.ts +27 -0
  47. package/dist/templates/default/packages/cli/telemetry.ts +266 -0
  48. package/dist/templates/default/packages/disposabl-kit/PAYMENTS.md +23 -5
  49. package/dist/templates/default/packages/disposabl-kit/client/lib/telemetry.ts +24 -2
  50. package/dist/templates/default/packages/disposabl-kit/client/lib/theme.ts +1 -0
  51. package/dist/templates/default/packages/disposabl-kit/client/routes/billing-login.tsx +92 -0
  52. package/dist/templates/default/packages/disposabl-kit/client/routes/pricing.tsx +113 -43
  53. package/dist/templates/default/packages/disposabl-kit/client/routes/route.tsx +13 -5
  54. package/dist/templates/default/packages/disposabl-kit/client/vite.config.ts +3 -2
  55. package/dist/templates/default/packages/disposabl-kit/lib/telemetry.ts +148 -12
  56. package/dist/templates/default/packages/disposabl-kit/mobile/billing/account-billing.tsx +143 -40
  57. package/dist/templates/default/packages/disposabl-kit/mobile/billing/paywall.ts +83 -0
  58. package/dist/templates/default/packages/disposabl-kit/mobile/billing/policy.ts +125 -0
  59. package/dist/templates/default/packages/disposabl-kit/mobile/billing/session.ts +31 -3
  60. package/dist/templates/default/packages/disposabl-kit/mobile/billing/topup.ts +99 -0
  61. package/dist/templates/default/packages/disposabl-kit/mobile/billing/use-topup.ts +116 -0
  62. package/dist/templates/default/packages/disposabl-kit/mobile/billing/web-checkout.ts +190 -0
  63. package/dist/templates/default/packages/disposabl-kit/mobile/layout.tsx +9 -2
  64. package/dist/templates/default/packages/disposabl-kit/package.json +10 -1
  65. package/dist/templates/default/packages/disposabl-kit/payments/checkout-attempt.ts +64 -0
  66. package/dist/templates/default/packages/disposabl-kit/payments/config.ts +16 -3
  67. package/dist/templates/default/packages/disposabl-kit/server/billing-functions.ts +218 -9
  68. package/dist/templates/default/packages/disposabl-kit/server/billing-handoff.ts +126 -0
  69. package/dist/templates/default/packages/disposabl-kit/server/billing-native-capability.ts +12 -0
  70. package/dist/templates/default/packages/disposabl-kit/server/billing-setup.ts +2 -0
  71. package/dist/templates/default/packages/disposabl-kit/server/billing.ts +31 -0
  72. package/dist/templates/default/packages/disposabl-kit/server/browser-session.ts +27 -0
  73. package/dist/templates/default/packages/disposabl-kit/server/lib/telemetry.ts +173 -59
  74. package/dist/templates/default/packages/disposabl-kit/server/revenuecat-contract.ts +233 -0
  75. package/dist/templates/default/packages/disposabl-kit/server/revenuecat-functions.ts +554 -0
  76. package/dist/templates/default/packages/disposabl-kit/server/revenuecat-validator.ts +76 -0
  77. package/dist/templates/default/packages/reconfigure-skill/SKILL.md +36 -0
  78. package/dist/templates/default/packages/sdk/README.md +21 -0
  79. package/dist/templates/default/packages/sdk/src/analytics.ts +102 -0
  80. package/dist/templates/default/packages/sdk/src/index.ts +2 -0
  81. package/dist/templates/default/packages/skill/SKILL.md +2 -0
  82. package/dist/templates/default/packages/skill/references/agent.md +2 -0
  83. package/dist/templates/default/packages/tests/billing-attempts.test.ts +156 -0
  84. package/dist/templates/default/packages/tests/billing-handoff.test.ts +116 -0
  85. package/dist/templates/default/packages/tests/billing-setup.test.ts +4 -3
  86. package/dist/templates/default/packages/tests/billing.test.ts +48 -4
  87. package/dist/templates/default/packages/tests/ci-platform-selection.test.ts +54 -0
  88. package/dist/templates/default/packages/tests/desktop-macos-release.test.ts +226 -0
  89. package/dist/templates/default/packages/tests/desktop-packaging.test.ts +12 -0
  90. package/dist/templates/default/packages/tests/flows/seo.e2e.ts +3 -1
  91. package/dist/templates/default/packages/tests/native-billing.test.ts +417 -0
  92. package/dist/templates/default/packages/tests/page-telemetry.test.ts +218 -0
  93. package/dist/templates/default/packages/tests/revenuecat-inbox.test.ts +476 -0
  94. package/dist/templates/default/packages/tests/sdk-analytics.test.ts +158 -0
  95. package/dist/templates/default/packages/tests/telemetry.test.ts +272 -55
  96. package/package.json +1 -1
  97. package/dist/templates/default/apps/web/src/routeTree.gen.ts +0 -578
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ set +x
4
+
5
+ clean_directory() {
6
+ local directory=$1
7
+ [[ "${directory%/*}" == "${RUNNER_TEMP:?}" && "${directory##*/}" == macos-signing.???????? && ! -L "$directory" ]] || return 1
8
+ security delete-keychain "$directory/signing.keychain-db" >/dev/null 2>&1 || true
9
+ rm -f -- "$directory/certificate.p12" "$directory/AuthKey.p8"
10
+ if [[ -d "$directory/mount" ]]; then
11
+ # Never recursively remove a volume that could not be detached.
12
+ hdiutil detach "$directory/mount" >/dev/null 2>&1 || rmdir "$directory/mount" || return 1
13
+ fi
14
+ rm -rf -- "$directory"
15
+ }
16
+
17
+ if [[ "${1:-}" == cleanup ]]; then
18
+ [[ -z "${MACOS_SIGNING_DIRECTORY:-}" ]] || clean_directory "$MACOS_SIGNING_DIRECTORY"
19
+ exit
20
+ fi
21
+
22
+ # This wrapper owns the credentials for the build and removes them on every exit.
23
+ if [[ -z "${MACOS_SIGNING_CONFIG:-}" ]]; then
24
+ export MACOS_NOTARIZE=false
25
+ bun run --cwd apps/desktop preview
26
+ exit
27
+ fi
28
+
29
+ for field in certificateBase64 certificatePassword identity teamId apiKeyBase64 apiKeyId apiIssuer; do
30
+ jq -e --arg field "$field" '.[$field] | type == "string" and length > 0 and (contains("\n") | not) and (contains("\r") | not)' <<< "$MACOS_SIGNING_CONFIG" >/dev/null || { echo "Invalid macOS signing configuration: $field" >&2; exit 1; }
31
+ done
32
+ identity=$(jq -r .identity <<< "$MACOS_SIGNING_CONFIG")
33
+ team=$(jq -r .teamId <<< "$MACOS_SIGNING_CONFIG")
34
+ [[ "$team" =~ ^[A-Z0-9]{10}$ && "$identity" == "Developer ID Application: "*" ($team)" ]] || { echo 'Expected a Developer ID Application identity and team ID' >&2; exit 1; }
35
+ temp=$(mktemp -d "${RUNNER_TEMP:?}/macos-signing.XXXXXXXX")
36
+ keychain="$temp/signing.keychain-db"
37
+ cleanup() { local status=$?; clean_directory "$temp" || status=1; exit "$status"; }
38
+ trap cleanup EXIT
39
+ trap 'exit 1' HUP INT TERM
40
+ printf 'MACOS_SIGNING_DIRECTORY=%s\n' "$temp" >> "${GITHUB_ENV:?}"
41
+ umask 077
42
+ jq -r .certificateBase64 <<< "$MACOS_SIGNING_CONFIG" | base64 -D > "$temp/certificate.p12"
43
+ jq -r .apiKeyBase64 <<< "$MACOS_SIGNING_CONFIG" | base64 -D > "$temp/AuthKey.p8"
44
+ password=$(openssl rand -hex 32)
45
+ security create-keychain -p "$password" "$keychain"
46
+ security set-keychain-settings -lut 1800 "$keychain"
47
+ security unlock-keychain -p "$password" "$keychain"
48
+ security import "$temp/certificate.p12" -k "$keychain" -P "$(jq -r .certificatePassword <<< "$MACOS_SIGNING_CONFIG")" -T /usr/bin/codesign
49
+ security set-key-partition-list -S apple-tool:,apple: -s -k "$password" "$keychain" >/dev/null
50
+ export MACOS_NOTARIZE=true MACOS_KEYCHAIN="$keychain" MACOS_SIGNING_IDENTITY="$identity"
51
+ export APPLE_API_KEY="$temp/AuthKey.p8" APPLE_API_KEY_ID="$(jq -r .apiKeyId <<< "$MACOS_SIGNING_CONFIG")" APPLE_API_ISSUER="$(jq -r .apiIssuer <<< "$MACOS_SIGNING_CONFIG")"
52
+ unset MACOS_SIGNING_CONFIG password
53
+ bun run --cwd apps/desktop preview
54
+ shopt -s nullglob
55
+ zips=(dist/release/*.zip)
56
+ dmgs=(dist/release/*.dmg)
57
+ [[ ${#zips[@]} == 1 && ${#dmgs[@]} == 1 ]] || { echo 'Expected one macOS update ZIP and DMG' >&2; exit 1; }
58
+ mkdir "$temp/verify"
59
+ ditto -x -k "${zips[0]}" "$temp/verify"
60
+ apps=("$temp"/verify/*.app)
61
+ [[ ${#apps[@]} == 1 ]] || { echo 'Expected one app in the update ZIP' >&2; exit 1; }
62
+ verify_app() {
63
+ local details
64
+ codesign --verify --deep --strict --verbose=2 "$1" >&2 || return 1
65
+ details=$(codesign -dv --verbose=4 "$1" 2>&1) || return 1
66
+ grep -Fx "Authority=$identity" <<< "$details" >/dev/null || return 1
67
+ grep -Fx "TeamIdentifier=$team" <<< "$details" >/dev/null || return 1
68
+ xcrun stapler validate "$1" >&2 || return 1
69
+ spctl --assess --type execute --verbose=2 "$1" >&2 || return 1
70
+ grep -E '^CDHash=[a-f0-9]+$' <<< "$details"
71
+ }
72
+ zip_hash=$(verify_app "${apps[0]}")
73
+ mkdir "$temp/mount"
74
+ hdiutil attach -readonly -nobrowse -mountpoint "$temp/mount" "${dmgs[0]}" >/dev/null
75
+ apps=("$temp"/mount/*.app)
76
+ [[ ${#apps[@]} == 1 ]] || { echo 'Expected one app in the DMG' >&2; exit 1; }
77
+ dmg_hash=$(verify_app "${apps[0]}")
78
+ [[ "$dmg_hash" == "$zip_hash" ]] || { echo 'DMG and update ZIP contain different apps' >&2; exit 1; }
79
+ hdiutil detach "$temp/mount" >/dev/null
80
+ [[ ! -d "$temp/mount" ]] || rmdir "$temp/mount"
81
+ echo 'MACOS_NOTARIZE=true' >> "${GITHUB_ENV:?}"
@@ -43,7 +43,7 @@ node --input-type=module -e '
43
43
  const mobile = /^(apps\/mobile\/|packages\/disposabl-kit\/|\.github\/scripts\/(mobile|apple|android-runner)\.sh$)/;
44
44
  for (const platform of ["android", "ios"]) console.log(`${platform}=${(platform === "ios" ? process.env.IOS_BUILDS_ENABLED !== "false" : process.env.EXPO_CONNECTED === "true") && affected(platform, mobile)}`);
45
45
  const production = process.env.GITHUB_EVENT_NAME === "push" && process.env.GITHUB_REF === "refs/heads/main";
46
- const desktop = (production ? ["linux", "windows", "macos"] : []).filter(platform => affected(platform, /^apps\/desktop\//))
46
+ const desktop = (production ? ["linux", "windows", "macos"] : []).filter(platform => affected(platform, platform === "macos" ? /^(apps\/desktop\/|\.github\/scripts\/macos-release\.sh$)/ : /^apps\/desktop\//))
47
47
  .map(platform => ({platform, runner: runners[platform]}));
48
48
  console.log(`desktop=${JSON.stringify(desktop)}`);
49
49
  const packages = (production ? ["cli", "sdk"] : []).filter(name => {
@@ -44,7 +44,7 @@ check_source() {
44
44
  else test "$(gh api "repos/$GH_REPO/pulls/$PR" --jq 'if .state == "open" then .head.sha else "closed" end')" = "$SOURCE"; fi
45
45
  }
46
46
  # Desktop installers publish only from main. Android retains PR previews.
47
- for platform in android linux windows; do
47
+ for platform in android linux windows macos; do
48
48
  [[ "$platform" == android || "$CHANNEL" == production ]] || continue
49
49
  directory="artifacts/release-$platform"
50
50
  test -d "$directory" || continue
@@ -403,7 +403,14 @@ jobs:
403
403
  echo "DISPOSABL_DESKTOP_ID=$id" >> "$GITHUB_ENV"
404
404
  echo "DISPOSABL_DESKTOP_UPDATE_URL=${CONVEX_SITE_URL}/desktop/updates/$id" >> "$GITHUB_ENV"
405
405
  - name: Build
406
+ if: matrix.platform != 'macos'
406
407
  run: bun run --cwd apps/desktop preview
408
+ - name: Build macOS
409
+ if: matrix.platform == 'macos'
410
+ shell: bash
411
+ env:
412
+ MACOS_SIGNING_CONFIG: ${{ secrets.MACOS_SIGNING_CONFIG }}
413
+ run: bash .github/scripts/macos-release.sh
407
414
  - *publish
408
415
  - name: Publish desktop update feed
409
416
  if: matrix.platform == 'windows' || (matrix.platform == 'macos' && env.MACOS_NOTARIZE == 'true')
@@ -414,7 +421,7 @@ jobs:
414
421
  test "$(gh api "repos/$GH_REPO/git/ref/heads/main" --jq .object.sha)" = "$SOURCE"
415
422
  node apps/desktop/publish-update.mjs
416
423
  - name: Upload desktop release artifacts
417
- if: matrix.platform != 'macos'
424
+ if: matrix.platform != 'macos' || env.MACOS_NOTARIZE == 'true'
418
425
  uses: actions/upload-artifact@v4
419
426
  with:
420
427
  name: release-${{ env.PLATFORM }}
@@ -431,7 +438,7 @@ jobs:
431
438
  retention-days: 3
432
439
  if-no-files-found: error
433
440
  - name: Upload unsigned macOS artifact
434
- if: matrix.platform == 'macos'
441
+ if: matrix.platform == 'macos' && env.MACOS_NOTARIZE != 'true'
435
442
  uses: actions/upload-artifact@v4
436
443
  with:
437
444
  name: macos-unsigned
@@ -442,13 +449,17 @@ jobs:
442
449
  compression-level: 0
443
450
  if-no-files-found: error
444
451
  - name: Report macOS artifact
445
- if: matrix.platform == 'macos'
452
+ if: matrix.platform == 'macos' && env.MACOS_NOTARIZE != 'true'
446
453
  run: |
447
454
  echo 'macOS DMG is ad-hoc signed, not Developer ID signed or notarized. Download it from this workflow run’s artifacts.' >> "$GITHUB_STEP_SUMMARY"
448
455
  node .github/scripts/disposabl.mjs report macos blocked 'Ad-hoc signed DMG available in workflow artifacts; Developer ID signing and notarization are not configured.'
449
456
  - name: Report desktop failure
450
457
  if: failure() || cancelled()
451
458
  run: node .github/scripts/disposabl.mjs report "$PLATFORM" failed
459
+ - name: Clean up macOS signing
460
+ if: always() && matrix.platform == 'macos'
461
+ shell: bash
462
+ run: bash .github/scripts/macos-release.sh cleanup
452
463
  packages:
453
464
  name: Package / ${{ matrix.package }}
454
465
  needs: [changes, web]
@@ -45,7 +45,7 @@ The root [pipeline](../../.github/workflows/pipeline.yml) selects enabled target
45
45
 
46
46
  The build helper temporarily sets version `1.<workflow run number>.<run attempt>`, creates the installers, restores `package.json`, and collects outputs in `dist/release`. Build jobs upload artifacts; the separate publisher checks the source commit and publishes Windows/Linux releases from trusted `main` scripts. Main release tags include the platform and workflow run. Forge itself does not publish.
47
47
 
48
- Windows and Linux installers are unsigned. macOS uses ad hoc signing and provides a DMG as a workflow artifact retained for three days. The pipeline does not currently configure Developer ID signing, notarization, or macOS GitHub releases. The signed macOS update lane still requires separate configuration described below.
48
+ Windows and Linux installers are unsigned. Without signing credentials, macOS uses ad hoc signing and provides a DMG as a workflow artifact retained for three days; updates remain blocked. With the signing configuration below, the production workflow signs, notarizes, verifies and publishes the macOS release and update feed.
49
49
 
50
50
  The desktop window uses `http://localhost:3000` during development and the deployed `CONVEX_SITE_URL` in packaged builds. It shares the website and authentication flow; if the site is unavailable, it shows the bundled starter page.
51
51
 
@@ -65,6 +65,17 @@ Each scaffolded app receives a random persistent `desktopId` in `disposabl.json`
65
65
 
66
66
  After building and verifying Windows artifacts, CI uses the same production `CONVEX_DEPLOY_KEY` already used for backend deployment to upload the full package to Convex file storage and atomically publish its feed record. The website's static-hosting component is not modified. Each release has an immutable versioned filename; existing packages remain in storage so in-flight clients can finish. Feed records are scoped to the app identity, channel, platform and architecture, and reject older workflow runs and attempts. Feed metadata is served without caching; package requests redirect to Convex storage, avoiding the HTTP action response limit. Failed or stale publications leave the previous feed in place. The publisher discards its uploaded blob only if no published feed references it; a lost cleanup response may still require manual storage reconciliation. Storage and egress are billable and retained versions require an explicit future retention policy. Convex upload URLs have a two-minute timeout; a slow or failed upload leaves the prior release available.
67
67
 
68
- macOS also produces a ZIP for Squirrel.Mac. A properly Developer ID signed and notarized build with `MACOS_NOTARIZE=true`, Apple API credentials and a matching signing identity can use the same upload path. Successive releases must retain the same signing identity and bundle identifier. The current CI lane has no signing credentials and creates only ad-hoc signed workflow artifacts, so it deliberately does not publish a macOS update feed. Signature verification remains enabled. Configure signing and notarization before expecting installed macOS updates to work. The existing Linux DEB/RPM artifacts do not configure an apt or RPM repository, so Linux native updates are unavailable until such a repository is provided.
68
+ macOS also produces a ZIP for Squirrel.Mac. To enable signed production releases, set the GitHub Actions secret `MACOS_SIGNING_CONFIG` to a JSON object with these string fields:
69
+
70
+ - `certificateBase64`: base64-encoded `.p12` containing the Developer ID Application certificate and private key.
71
+ - `certificatePassword`: password for that `.p12`.
72
+ - `identity`: the full signing identity, for example `Developer ID Application: Example, Inc. (ABCDE12345)`.
73
+ - `teamId`: the ten-character Apple team ID matching that identity.
74
+ - `apiKeyBase64`: base64-encoded App Store Connect API `.p8` key for notarization.
75
+ - `apiKeyId` and `apiIssuer`: the API key ID and issuer ID.
76
+
77
+ Encode the base64 values on one line. Do not commit this JSON or its source files.
78
+
79
+ The workflow imports the certificate into a temporary keychain, builds and notarizes, then verifies the apps inside both the update ZIP and the read-only mounted DMG, including their signing identity, stapled tickets and Gatekeeper assessment. Their code-directory hashes must match before either is published. A shell trap and an always-run cleanup step remove only that job's keychain and temporary files on normal failures and cancellation; forced termination can prevent cleanup, so self-hosted runners must also clean their temporary directory. Keep the signing identity and bundle identifier stable across releases. A valid Apple Developer ID certificate, notarization access and a macOS runner are required; configuring the secret alone does not prove delivery. The existing Linux DEB/RPM artifacts do not configure an apt or RPM repository, so Linux native updates are unavailable until such a repository is provided.
69
80
 
70
81
  Verify delivery using two installed versions on each supported OS, checking no-update, download, restart, signature rejection and recovery from a failed feed. Building or staging an artifact alone does not prove update delivery. See [Electron's updater documentation](https://www.electronjs.org/docs/latest/api/auto-updater) and [static feed format](https://www.electronjs.org/docs/latest/tutorial/updates).
@@ -31,7 +31,9 @@ if (
31
31
  signedRelease &&
32
32
  (!process.env.APPLE_API_KEY ||
33
33
  !process.env.APPLE_API_KEY_ID ||
34
- !process.env.APPLE_API_ISSUER)
34
+ !process.env.APPLE_API_ISSUER ||
35
+ !process.env.MACOS_SIGNING_IDENTITY ||
36
+ !process.env.MACOS_KEYCHAIN)
35
37
  )
36
38
  throw new Error('macOS releases require Apple notarization credentials');
37
39
 
@@ -51,7 +53,10 @@ const config: ForgeConfig = {
51
53
  ...(process.platform === 'darwin'
52
54
  ? {
53
55
  osxSign: signedRelease
54
- ? {}
56
+ ? {
57
+ identity: process.env.MACOS_SIGNING_IDENTITY!,
58
+ keychain: process.env.MACOS_KEYCHAIN!,
59
+ }
55
60
  : {
56
61
  identity: '-',
57
62
  identityValidation: false,
@@ -92,7 +97,8 @@ const config: ForgeConfig = {
92
97
  makers: [
93
98
  new MakerSquirrel({ setupIcon: 'src/assets/icon.ico' }),
94
99
  new MakerZIP({}, ['darwin']),
95
- new MakerDMG({ format: 'ULFO' }),
100
+ // The HFS+ volume title is limited; keep app and artifact names unchanged.
101
+ new MakerDMG({ format: 'ULFO', title: 'Install' }),
96
102
  new MakerRpm({ options: rpmOptions }),
97
103
  new MakerDeb({
98
104
  options: { name: executableName, bin: executableName, mimeType },
@@ -23,4 +23,4 @@ Authentication, analytics, payments, and documentation are optional. Use the gen
23
23
 
24
24
  Run `bun run test` for your selected platforms. Native tests require a locally installed build and an available simulator or emulator. Check the visible login, empty state, and first useful action on each target.
25
25
 
26
- If you selected payments, the starter includes editable examples: a $5 monthly plan with 500 credits and a $5 top-up with 500 non-expiring credits. Configure the provider and verify sandbox purchases before enabling live payments. See `packages/disposabl-kit/PAYMENTS.md`.
26
+ If you selected payments, the starter includes editable examples: a $5 monthly plan with 750 credits that expire each cycle and a $5 top-up with 500 non-expiring credits. Configure the provider and verify sandbox purchases before enabling live payments. See `packages/disposabl-kit/PAYMENTS.md`.
@@ -33,6 +33,7 @@
33
33
  "react-native-css": "3.1.0-rc.1",
34
34
  "react-native-gesture-handler": "~3.3.0",
35
35
  "react-native-purchases": "10.16.0",
36
+ "react-native-purchases-ui": "10.16.0",
36
37
  "react-native-reanimated": "4.7.1",
37
38
  "react-native-safe-area-context": "~5.11.1",
38
39
  "react-native-screens": "~4.30.1",
@@ -16,6 +16,10 @@ export default [
16
16
  },
17
17
  },
18
18
  {
19
- ignores: ["eslint.config.js", ".prettierrc"],
19
+ ignores: [
20
+ "eslint.config.js",
21
+ ".prettierrc",
22
+ "public/landing/taste/**/*.js",
23
+ ],
20
24
  },
21
25
  ];
@@ -0,0 +1,8 @@
1
+ <svg width="1024" height="1024" viewBox="0 0 1024 1024" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill="#F8F5EF" d="M616 142h166v740H616v-76c-52 53-119 80-201 80-151 0-274-123-274-274s123-274 274-274c74 0 141 28 201 80V142Zm-183 362c-61 0-110 49-110 109s49 109 110 109 110-49 110-109-49-109-110-109Z"/>
3
+ <rect x="285" y="413" width="331" height="315" rx="36" fill="#101A32"/>
4
+ <path d="M285 489h331" stroke="#F8F5EF" stroke-width="24"/>
5
+ <circle cx="336" cy="451" r="12" fill="#F8F5EF"/>
6
+ <circle cx="375" cy="451" r="12" fill="#F8F5EF" opacity=".42"/>
7
+ <path d="m378 574 154-64v205l-154-75V574Z" fill="#FF6B57"/>
8
+ </svg>
@@ -0,0 +1,46 @@
1
+ <svg id="livetype" xmlns="http://www.w3.org/2000/svg" width="119.66407" height="40" viewBox="0 0 119.66407 40">
2
+ <title>Download_on_the_App_Store_Badge_US-UK_RGB_blk_4SVG_092917</title>
3
+ <g>
4
+ <g>
5
+ <g>
6
+ <path d="M110.13477,0H9.53468c-.3667,0-.729,0-1.09473.002-.30615.002-.60986.00781-.91895.0127A13.21476,13.21476,0,0,0,5.5171.19141a6.66509,6.66509,0,0,0-1.90088.627A6.43779,6.43779,0,0,0,1.99757,1.99707,6.25844,6.25844,0,0,0,.81935,3.61816a6.60119,6.60119,0,0,0-.625,1.90332,12.993,12.993,0,0,0-.1792,2.002C.00587,7.83008.00489,8.1377,0,8.44434V31.5586c.00489.3105.00587.6113.01515.9219a12.99232,12.99232,0,0,0,.1792,2.0019,6.58756,6.58756,0,0,0,.625,1.9043A6.20778,6.20778,0,0,0,1.99757,38.001a6.27445,6.27445,0,0,0,1.61865,1.1787,6.70082,6.70082,0,0,0,1.90088.6308,13.45514,13.45514,0,0,0,2.0039.1768c.30909.0068.6128.0107.91895.0107C8.80567,40,9.168,40,9.53468,40H110.13477c.3594,0,.7246,0,1.084-.002.3047,0,.6172-.0039.9219-.0107a13.279,13.279,0,0,0,2-.1768,6.80432,6.80432,0,0,0,1.9082-.6308,6.27742,6.27742,0,0,0,1.6172-1.1787,6.39482,6.39482,0,0,0,1.1816-1.6143,6.60413,6.60413,0,0,0,.6191-1.9043,13.50643,13.50643,0,0,0,.1856-2.0019c.0039-.3106.0039-.6114.0039-.9219.0078-.3633.0078-.7246.0078-1.0938V9.53613c0-.36621,0-.72949-.0078-1.09179,0-.30664,0-.61426-.0039-.9209a13.5071,13.5071,0,0,0-.1856-2.002,6.6177,6.6177,0,0,0-.6191-1.90332,6.46619,6.46619,0,0,0-2.7988-2.7998,6.76754,6.76754,0,0,0-1.9082-.627,13.04394,13.04394,0,0,0-2-.17676c-.3047-.00488-.6172-.01074-.9219-.01269-.3594-.002-.7246-.002-1.084-.002Z" style="fill: #a6a6a6"/>
7
+ <path d="M8.44483,39.125c-.30468,0-.602-.0039-.90429-.0107a12.68714,12.68714,0,0,1-1.86914-.1631,5.88381,5.88381,0,0,1-1.65674-.5479,5.40573,5.40573,0,0,1-1.397-1.0166,5.32082,5.32082,0,0,1-1.02051-1.3965,5.72186,5.72186,0,0,1-.543-1.6572,12.41351,12.41351,0,0,1-.1665-1.875c-.00634-.2109-.01464-.9131-.01464-.9131V8.44434S.88185,7.75293.8877,7.5498a12.37039,12.37039,0,0,1,.16553-1.87207,5.7555,5.7555,0,0,1,.54346-1.6621A5.37349,5.37349,0,0,1,2.61183,2.61768,5.56543,5.56543,0,0,1,4.01417,1.59521a5.82309,5.82309,0,0,1,1.65332-.54394A12.58589,12.58589,0,0,1,7.543.88721L8.44532.875H111.21387l.9131.0127a12.38493,12.38493,0,0,1,1.8584.16259,5.93833,5.93833,0,0,1,1.6709.54785,5.59374,5.59374,0,0,1,2.415,2.41993,5.76267,5.76267,0,0,1,.5352,1.64892,12.995,12.995,0,0,1,.1738,1.88721c.0029.2832.0029.5874.0029.89014.0079.375.0079.73193.0079,1.09179V30.4648c0,.3633,0,.7178-.0079,1.0752,0,.3252,0,.6231-.0039.9297a12.73126,12.73126,0,0,1-.1709,1.8535,5.739,5.739,0,0,1-.54,1.67,5.48029,5.48029,0,0,1-1.0156,1.3857,5.4129,5.4129,0,0,1-1.3994,1.0225,5.86168,5.86168,0,0,1-1.668.5498,12.54218,12.54218,0,0,1-1.8692.1631c-.2929.0068-.5996.0107-.8974.0107l-1.084.002Z"/>
8
+ </g>
9
+ <g id="_Group_" data-name="&lt;Group&gt;">
10
+ <g id="_Group_2" data-name="&lt;Group&gt;">
11
+ <g id="_Group_3" data-name="&lt;Group&gt;">
12
+ <path id="_Path_" data-name="&lt;Path&gt;" d="M24.76888,20.30068a4.94881,4.94881,0,0,1,2.35656-4.15206,5.06566,5.06566,0,0,0-3.99116-2.15768c-1.67924-.17626-3.30719,1.00483-4.1629,1.00483-.87227,0-2.18977-.98733-3.6085-.95814a5.31529,5.31529,0,0,0-4.47292,2.72787c-1.934,3.34842-.49141,8.26947,1.3612,10.97608.9269,1.32535,2.01018,2.8058,3.42763,2.7533,1.38706-.05753,1.9051-.88448,3.5794-.88448,1.65876,0,2.14479.88448,3.591.8511,1.48838-.02416,2.42613-1.33124,3.32051-2.66914a10.962,10.962,0,0,0,1.51842-3.09251A4.78205,4.78205,0,0,1,24.76888,20.30068Z" style="fill: #fff"/>
13
+ <path id="_Path_2" data-name="&lt;Path&gt;" d="M22.03725,12.21089a4.87248,4.87248,0,0,0,1.11452-3.49062,4.95746,4.95746,0,0,0-3.20758,1.65961,4.63634,4.63634,0,0,0-1.14371,3.36139A4.09905,4.09905,0,0,0,22.03725,12.21089Z" style="fill: #fff"/>
14
+ </g>
15
+ </g>
16
+ <g>
17
+ <path d="M42.30227,27.13965h-4.7334l-1.13672,3.35645H34.42727l4.4834-12.418h2.083l4.4834,12.418H43.438ZM38.0591,25.59082h3.752l-1.84961-5.44727h-.05176Z" style="fill: #fff"/>
18
+ <path d="M55.15969,25.96973c0,2.81348-1.50586,4.62109-3.77832,4.62109a3.0693,3.0693,0,0,1-2.84863-1.584h-.043v4.48438h-1.8584V21.44238H48.4302v1.50586h.03418a3.21162,3.21162,0,0,1,2.88281-1.60059C53.645,21.34766,55.15969,23.16406,55.15969,25.96973Zm-1.91016,0c0-1.833-.94727-3.03809-2.39258-3.03809-1.41992,0-2.375,1.23047-2.375,3.03809,0,1.82422.95508,3.0459,2.375,3.0459C52.30227,29.01563,53.24953,27.81934,53.24953,25.96973Z" style="fill: #fff"/>
19
+ <path d="M65.12453,25.96973c0,2.81348-1.50586,4.62109-3.77832,4.62109a3.0693,3.0693,0,0,1-2.84863-1.584h-.043v4.48438h-1.8584V21.44238H58.395v1.50586h.03418A3.21162,3.21162,0,0,1,61.312,21.34766C63.60988,21.34766,65.12453,23.16406,65.12453,25.96973Zm-1.91016,0c0-1.833-.94727-3.03809-2.39258-3.03809-1.41992,0-2.375,1.23047-2.375,3.03809,0,1.82422.95508,3.0459,2.375,3.0459C62.26711,29.01563,63.21438,27.81934,63.21438,25.96973Z" style="fill: #fff"/>
20
+ <path d="M71.71047,27.03613c.1377,1.23145,1.334,2.04,2.96875,2.04,1.56641,0,2.69336-.80859,2.69336-1.91895,0-.96387-.67969-1.541-2.28906-1.93652l-1.60937-.3877c-2.28027-.55078-3.33887-1.61719-3.33887-3.34766,0-2.14258,1.86719-3.61426,4.51855-3.61426,2.624,0,4.42285,1.47168,4.4834,3.61426h-1.876c-.1123-1.23926-1.13672-1.9873-2.63379-1.9873s-2.52148.75684-2.52148,1.8584c0,.87793.6543,1.39453,2.25488,1.79l1.36816.33594c2.54785.60254,3.60645,1.626,3.60645,3.44238,0,2.32324-1.85059,3.77832-4.79395,3.77832-2.75391,0-4.61328-1.4209-4.7334-3.667Z" style="fill: #fff"/>
21
+ <path d="M83.34621,19.2998v2.14258h1.72168v1.47168H83.34621v4.99121c0,.77539.34473,1.13672,1.10156,1.13672a5.80752,5.80752,0,0,0,.61133-.043v1.46289a5.10351,5.10351,0,0,1-1.03223.08594c-1.833,0-2.54785-.68848-2.54785-2.44434V22.91406H80.16262V21.44238H81.479V19.2998Z" style="fill: #fff"/>
22
+ <path d="M86.065,25.96973c0-2.84863,1.67773-4.63867,4.29395-4.63867,2.625,0,4.29492,1.79,4.29492,4.63867,0,2.85645-1.66113,4.63867-4.29492,4.63867C87.72609,30.6084,86.065,28.82617,86.065,25.96973Zm6.69531,0c0-1.9541-.89551-3.10742-2.40137-3.10742s-2.40039,1.16211-2.40039,3.10742c0,1.96191.89453,3.10645,2.40039,3.10645S92.76027,27.93164,92.76027,25.96973Z" style="fill: #fff"/>
23
+ <path d="M96.18606,21.44238h1.77246v1.541h.043a2.1594,2.1594,0,0,1,2.17773-1.63574,2.86616,2.86616,0,0,1,.63672.06934v1.73828a2.59794,2.59794,0,0,0-.835-.1123,1.87264,1.87264,0,0,0-1.93652,2.083v5.37012h-1.8584Z" style="fill: #fff"/>
24
+ <path d="M109.3843,27.83691c-.25,1.64355-1.85059,2.77148-3.89844,2.77148-2.63379,0-4.26855-1.76465-4.26855-4.5957,0-2.83984,1.64355-4.68164,4.19043-4.68164,2.50488,0,4.08008,1.7207,4.08008,4.46582v.63672h-6.39453v.1123a2.358,2.358,0,0,0,2.43555,2.56445,2.04834,2.04834,0,0,0,2.09082-1.27344Zm-6.28223-2.70215h4.52637a2.1773,2.1773,0,0,0-2.2207-2.29785A2.292,2.292,0,0,0,103.10207,25.13477Z" style="fill: #fff"/>
25
+ </g>
26
+ </g>
27
+ </g>
28
+ <g id="_Group_4" data-name="&lt;Group&gt;">
29
+ <g>
30
+ <path d="M37.82619,8.731a2.63964,2.63964,0,0,1,2.80762,2.96484c0,1.90625-1.03027,3.002-2.80762,3.002H35.67092V8.731Zm-1.22852,5.123h1.125a1.87588,1.87588,0,0,0,1.96777-2.146,1.881,1.881,0,0,0-1.96777-2.13379h-1.125Z" style="fill: #fff"/>
31
+ <path d="M41.68068,12.44434a2.13323,2.13323,0,1,1,4.24707,0,2.13358,2.13358,0,1,1-4.24707,0Zm3.333,0c0-.97607-.43848-1.54687-1.208-1.54687-.77246,0-1.207.5708-1.207,1.54688,0,.98389.43457,1.55029,1.207,1.55029C44.57522,13.99463,45.01369,13.42432,45.01369,12.44434Z" style="fill: #fff"/>
32
+ <path d="M51.57326,14.69775h-.92187l-.93066-3.31641h-.07031l-.92676,3.31641h-.91309l-1.24121-4.50293h.90137l.80664,3.436h.06641l.92578-3.436h.85254l.92578,3.436h.07031l.80273-3.436h.88867Z" style="fill: #fff"/>
33
+ <path d="M53.85354,10.19482H54.709v.71533h.06641a1.348,1.348,0,0,1,1.34375-.80225,1.46456,1.46456,0,0,1,1.55859,1.6748v2.915h-.88867V12.00586c0-.72363-.31445-1.0835-.97168-1.0835a1.03294,1.03294,0,0,0-1.0752,1.14111v2.63428h-.88867Z" style="fill: #fff"/>
34
+ <path d="M59.09377,8.437h.88867v6.26074h-.88867Z" style="fill: #fff"/>
35
+ <path d="M61.21779,12.44434a2.13346,2.13346,0,1,1,4.24756,0,2.1338,2.1338,0,1,1-4.24756,0Zm3.333,0c0-.97607-.43848-1.54687-1.208-1.54687-.77246,0-1.207.5708-1.207,1.54688,0,.98389.43457,1.55029,1.207,1.55029C64.11232,13.99463,64.5508,13.42432,64.5508,12.44434Z" style="fill: #fff"/>
36
+ <path d="M66.4009,13.42432c0-.81055.60352-1.27783,1.6748-1.34424l1.21973-.07031v-.38867c0-.47559-.31445-.74414-.92187-.74414-.49609,0-.83984.18213-.93848.50049h-.86035c.09082-.77344.81836-1.26953,1.83984-1.26953,1.12891,0,1.76563.562,1.76563,1.51318v3.07666h-.85547v-.63281h-.07031a1.515,1.515,0,0,1-1.35254.707A1.36026,1.36026,0,0,1,66.4009,13.42432Zm2.89453-.38477v-.37646l-1.09961.07031c-.62012.0415-.90137.25244-.90137.64941,0,.40527.35156.64111.835.64111A1.0615,1.0615,0,0,0,69.29543,13.03955Z" style="fill: #fff"/>
37
+ <path d="M71.34816,12.44434c0-1.42285.73145-2.32422,1.86914-2.32422a1.484,1.484,0,0,1,1.38086.79h.06641V8.437h.88867v6.26074h-.85156v-.71143h-.07031a1.56284,1.56284,0,0,1-1.41406.78564C72.0718,14.772,71.34816,13.87061,71.34816,12.44434Zm.918,0c0,.95508.4502,1.52979,1.20313,1.52979.749,0,1.21191-.583,1.21191-1.52588,0-.93848-.46777-1.52979-1.21191-1.52979C72.72121,10.91846,72.26613,11.49707,72.26613,12.44434Z" style="fill: #fff"/>
38
+ <path d="M79.23,12.44434a2.13323,2.13323,0,1,1,4.24707,0,2.13358,2.13358,0,1,1-4.24707,0Zm3.333,0c0-.97607-.43848-1.54687-1.208-1.54687-.77246,0-1.207.5708-1.207,1.54688,0,.98389.43457,1.55029,1.207,1.55029C82.12453,13.99463,82.563,13.42432,82.563,12.44434Z" style="fill: #fff"/>
39
+ <path d="M84.66945,10.19482h.85547v.71533h.06641a1.348,1.348,0,0,1,1.34375-.80225,1.46456,1.46456,0,0,1,1.55859,1.6748v2.915H87.605V12.00586c0-.72363-.31445-1.0835-.97168-1.0835a1.03294,1.03294,0,0,0-1.0752,1.14111v2.63428h-.88867Z" style="fill: #fff"/>
40
+ <path d="M93.51516,9.07373v1.1416h.97559v.74854h-.97559V13.2793c0,.47168.19434.67822.63672.67822a2.96657,2.96657,0,0,0,.33887-.02051v.74023a2.9155,2.9155,0,0,1-.4834.04541c-.98828,0-1.38184-.34766-1.38184-1.21582v-2.543h-.71484v-.74854h.71484V9.07373Z" style="fill: #fff"/>
41
+ <path d="M95.70461,8.437h.88086v2.48145h.07031a1.3856,1.3856,0,0,1,1.373-.80664,1.48339,1.48339,0,0,1,1.55078,1.67871v2.90723H98.69v-2.688c0-.71924-.335-1.0835-.96289-1.0835a1.05194,1.05194,0,0,0-1.13379,1.1416v2.62988h-.88867Z" style="fill: #fff"/>
42
+ <path d="M104.76125,13.48193a1.828,1.828,0,0,1-1.95117,1.30273A2.04531,2.04531,0,0,1,100.73,12.46045a2.07685,2.07685,0,0,1,2.07617-2.35254c1.25293,0,2.00879.856,2.00879,2.27V12.688h-3.17969v.0498a1.1902,1.1902,0,0,0,1.19922,1.29,1.07934,1.07934,0,0,0,1.07129-.5459Zm-3.126-1.45117h2.27441a1.08647,1.08647,0,0,0-1.1084-1.1665A1.15162,1.15162,0,0,0,101.63527,12.03076Z" style="fill: #fff"/>
43
+ </g>
44
+ </g>
45
+ </g>
46
+ </svg>
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Leonxlnx
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,3 @@
1
+ import { refresh } from './motion/motion.js';
2
+ import { mountAll, unmountAll } from './moments/moments.js';
3
+ window.disposablLandingMotion = { refresh, mountAll, unmountAll };
@@ -0,0 +1,189 @@
1
+ /*
2
+ moments/lib.js - the few helpers every moment shares (taste-skill). One ES module, no dependencies.
3
+
4
+ reduced() true under prefers-reduced-motion: a moment then shows its finished state only
5
+ phone() true on a phone: under 640px wide, or a touch screen in landscape under 500px tall
6
+ (a phone turned sideways). A moment shows its finished state there too, unless
7
+ its module says `export const phone = true` (word-highlight, picture-develops,
8
+ photo-chapters: light enough to run there).
9
+ still() reduced() || phone(): the one question every moment asks. The loader (moments.js)
10
+ hands each moment a lib whose reduced() answers still() (only reduced() for a
11
+ moment that runs on a phone), so a moment written against reduced() is static
12
+ where it must be, and sets data-moment-still on its host ("reduced" or "phone").
13
+ The answer is taken once, when the page loads.
14
+ coarse() true on a touch screen (no hover moments there)
15
+ inCard(el) true when el is, or sits in, a card, a plan, a result or a bento cell: nothing
16
+ on a card ever moves on scroll, so the loader leaves such a moment still
17
+ scrub(el, fn, opts) calls fn(progress, rect) from a requestAnimationFrame while el is near the
18
+ screen. mode 'hold' (default): 0 when el's top reaches the viewport top, 1 when
19
+ its bottom reaches the viewport bottom (a pinned stage's run). mode 'view': 0 when
20
+ el's top enters at the bottom edge, 1 when its bottom leaves at the top.
21
+ Returns { destroy, update }. Nothing is captured: the page scrolls natively.
22
+ once(el, fn, opts) fn once: when `threshold` of el is on screen, or el covers that share of the screen (a
23
+ target taller than the screen can never show it), or part of it has stayed on screen
24
+ for opts.rescue ms (3000), or the observer has not reported at all after 1.5 s of a
25
+ visible page. Nothing waits for ever. Returns { destroy }.
26
+ split(el, unit) wraps the words ('words') or letters ('chars') of el in spans
27
+ (.mo-w, .mo-c, each with an inner .mo-i that moves) and keeps the text readable:
28
+ the host gets aria-label, the spans aria-hidden. Returns the inner spans.
29
+ lines(words) groups word spans into lines by their offsetTop; returns an array of arrays.
30
+ fontsReady(ms) resolves when the fonts are loaded, or after ms.
31
+ clamp, lerp, ease the maths.
32
+ */
33
+ const rq = typeof matchMedia === 'function' ? matchMedia('(prefers-reduced-motion: reduce)') : null;
34
+ export const reduced = () => !!(rq && rq.matches);
35
+ const pq = typeof matchMedia === 'function' ? [matchMedia('(max-width: 639px)'), matchMedia('(pointer: coarse) and (max-height: 499px) and (max-width: 959px)')] : [];
36
+ export const phone = () => pq.some(q => q.matches);
37
+ export const still = () => reduced() || phone();
38
+ export const stillWhy = () => (reduced() ? 'reduced' : phone() ? 'phone' : '');
39
+ export const inCard = el => !!(el && el.closest && el.closest('.card, .plan, .result, .knock, [data-card], .bento > *'));
40
+ export const coarse = () => typeof matchMedia === 'function' && matchMedia('(pointer: coarse)').matches;
41
+ export const clamp = (v, a = 0, b = 1) => Math.min(b, Math.max(a, v));
42
+ export const lerp = (a, b, t) => a + (b - a) * t;
43
+ export const ease = {
44
+ out: t => 1 - Math.pow(1 - t, 3),
45
+ quint: t => 1 - Math.pow(1 - t, 5),
46
+ expo: t => (t >= 1 ? 1 : 1 - Math.pow(2, -10 * t)),
47
+ inOut: t => (t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2),
48
+ smooth: (a, b, x) => { const t = clamp((x - a) / (b - a)); return t * t * (3 - 2 * t); },
49
+ };
50
+
51
+ export function scrub(el, fn, { mode = 'hold', margin = '25% 0px' } = {}) {
52
+ // on from the start, with the scroll listener: an observer that never reports (a dead stub, a page it cannot reach) leaves the
53
+ // moment following the scroll instead of frozen at its first state; the observer turns it off when the target is far away
54
+ let on = true, raf = 0, last = -1;
55
+ const tick = () => {
56
+ raf = 0;
57
+ if (!on) return;
58
+ const r = el.getBoundingClientRect(), vh = innerHeight;
59
+ let p = mode === 'view' ? (vh - r.top) / (vh + r.height) : -r.top / Math.max(1, r.height - vh);
60
+ p = clamp(p);
61
+ if (p !== last) { last = p; fn(p, r); }
62
+ };
63
+ const req = () => { if (!raf) raf = requestAnimationFrame(tick); };
64
+ const io = new IntersectionObserver(es => {
65
+ on = es[es.length - 1].isIntersecting;
66
+ removeEventListener('scroll', req); removeEventListener('resize', req);
67
+ if (on) { addEventListener('scroll', req, { passive: true }); addEventListener('resize', req); req(); }
68
+ }, { rootMargin: margin });
69
+ io.observe(el);
70
+ addEventListener('scroll', req, { passive: true }); addEventListener('resize', req); req();
71
+ return {
72
+ update: () => { last = -1; req(); },
73
+ destroy() { io.disconnect(); removeEventListener('scroll', req); removeEventListener('resize', req); if (raf) cancelAnimationFrame(raf); },
74
+ };
75
+ }
76
+
77
+ export function once(el, fn, { threshold = 0.35, margin = '0px', rescue = 3000 } = {}) {
78
+ // fn runs once when `threshold` of el is on screen, or el covers that share of the screen (a target taller
79
+ // than the screen can never show `threshold` of itself), or any part of it has stayed on screen for `rescue`
80
+ // ms. An observer that has not reported at all after 1.5 s of a visible page runs fn too: nothing waits for ever
81
+ let timer = 0, starve = 0, done = false;
82
+ const go = () => { if (done) return; done = true; clearTimeout(timer); clearTimeout(starve); io.disconnect(); fn(); };
83
+ const steps = [0];
84
+ for (let t = 0.1; t < threshold - 1e-6; t += 0.1) steps.push(+t.toFixed(2));
85
+ steps.push(threshold);
86
+ const io = new IntersectionObserver(es => {
87
+ clearTimeout(starve);
88
+ const e = es[es.length - 1];
89
+ if (!e.isIntersecting) { clearTimeout(timer); timer = 0; return; }
90
+ const vh = e.rootBounds ? e.rootBounds.height : innerHeight;
91
+ if (e.intersectionRatio >= threshold || e.intersectionRect.height >= vh * threshold) return go();
92
+ if (!timer) timer = setTimeout(go, rescue);
93
+ }, { threshold: steps, rootMargin: margin });
94
+ const wait = () => { starve = setTimeout(() => (document.hidden ? wait() : go()), 1500); };
95
+ wait();
96
+ io.observe(el);
97
+ return { destroy() { done = true; clearTimeout(timer); clearTimeout(starve); io.disconnect(); } };
98
+ }
99
+
100
+ export function split(el, unit = 'words') {
101
+ if (!el.getAttribute('aria-label')) el.setAttribute('aria-label', el.textContent.replace(/\s+/g, ' ').trim());
102
+ const inners = [];
103
+ const wrap = (text, cls) => {
104
+ const s = document.createElement('span');
105
+ s.className = cls;
106
+ const i = document.createElement('span');
107
+ i.className = 'mo-i';
108
+ i.textContent = text;
109
+ s.append(i);
110
+ inners.push(i);
111
+ return s;
112
+ };
113
+ const walk = node => {
114
+ [...node.childNodes].forEach(n => {
115
+ if (n.nodeType === 3) {
116
+ const frag = document.createDocumentFragment();
117
+ n.textContent.split(/(\s+)/).forEach(part => {
118
+ if (!part) return;
119
+ if (/^\s+$/.test(part)) { frag.append(' '); return; }
120
+ if (unit === 'chars') {
121
+ const w = document.createElement('span');
122
+ w.className = 'mo-w';
123
+ for (const ch of part) w.append(wrap(ch, 'mo-c'));
124
+ frag.append(w);
125
+ } else frag.append(wrap(part, 'mo-w'));
126
+ });
127
+ n.replaceWith(frag);
128
+ } else if (n.nodeType === 1 && !n.classList.contains('mo-w')) {
129
+ // a link or button inside keeps its name: its words are hidden with the rest, so it is named first
130
+ if (n.matches('a[href], button') && !n.getAttribute('aria-label') && n.textContent.trim()) n.setAttribute('aria-label', n.textContent.replace(/\s+/g, ' ').trim());
131
+ walk(n);
132
+ }
133
+ });
134
+ };
135
+ walk(el);
136
+ el.querySelectorAll('.mo-w').forEach(w => w.setAttribute('aria-hidden', 'true'));
137
+ return inners;
138
+ }
139
+
140
+ export function lines(words) {
141
+ const out = [];
142
+ let top = null;
143
+ for (const w of words) {
144
+ const t = w.offsetTop;
145
+ if (top === null || Math.abs(t - top) > 2) { out.push([]); top = t; }
146
+ out[out.length - 1].push(w);
147
+ }
148
+ return out;
149
+ }
150
+
151
+ export const fontsReady = (ms = 900) => Promise.race([document.fonts ? document.fonts.ready : Promise.resolve(), new Promise(r => setTimeout(r, ms))]);
152
+
153
+ /*
154
+ blocks(root, skip) the section's words and pictures as whole blocks, for a moment that uncovers a section with a
155
+ clip (a disc, a line): a block is a heading, paragraph, list item, button, link, picture, UI
156
+ window or any element that carries text of its own, outermost first (a frame with its own
157
+ text is one block). A clip that slices through a block cuts its words mid-move, so such a
158
+ moment keeps each block invisible until the clip has passed the whole of it, then fades it
159
+ in whole. Returns { list, measure, set, release }:
160
+ list [{ el, l, t, r, b }] with the box of each block in root's own coordinates (set by measure)
161
+ measure() reads the boxes again (call when the root's size changes or the fonts arrive)
162
+ set(fn) fn(block) -> opacity 0-1 for every block; 1 puts the element's own inline opacity back
163
+ release() every block as it was
164
+ skip: elements (the moment's own layers) that are never a block.
165
+ */
166
+ const BLOCK = 'h1,h2,h3,h4,h5,h6,p,li,dt,dd,blockquote,figcaption,label,a,button,img,picture,video,canvas,svg,table,figure,.frame,.dw,[data-moment-block]';
167
+ export function blocks(root, skip = []) {
168
+ const list = [];
169
+ const walk = el => {
170
+ for (const c of el.children) {
171
+ if (skip.includes(c) || /^(SCRIPT|STYLE|NOSCRIPT|TEMPLATE)$/.test(c.tagName)) continue;
172
+ const own = [...c.childNodes].some(n => n.nodeType === 3 && n.textContent.trim());
173
+ if (c.matches(BLOCK) || own) list.push({ el: c, was: c.style.opacity, l: 0, t: 0, r: 0, b: 0 });
174
+ else walk(c);
175
+ }
176
+ };
177
+ walk(root);
178
+ const measure = () => {
179
+ const rr = root.getBoundingClientRect();
180
+ for (const b of list) {
181
+ const r = b.el.getBoundingClientRect();
182
+ b.l = r.left - rr.left; b.t = r.top - rr.top; b.r = r.right - rr.left; b.b = r.bottom - rr.top;
183
+ }
184
+ };
185
+ measure();
186
+ const set = fn => { for (const b of list) { const o = fn(b); b.el.style.opacity = o >= 0.999 ? b.was : (o <= 0 ? '0' : o.toFixed(3)); } };
187
+ const release = () => { for (const b of list) b.el.style.opacity = b.was; };
188
+ return { list, measure, set, release };
189
+ }