Svelte conversion — quick and dirty
Some checks failed
ci/woodpecker/pr/ci Pipeline failed

This commit is contained in:
2026-02-15 14:10:57 -03:00
parent e712e73902
commit 99cb89d1e8
198 changed files with 3192 additions and 1193 deletions

View File

@@ -5,15 +5,19 @@
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {} "ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
}, },
"postCreateCommand": "corepack enable && corepack prepare pnpm@10.29.2 --activate && pnpm install", "postCreateCommand": "corepack enable && corepack prepare pnpm@10.29.2 --activate && pnpm install",
"forwardPorts": [3000, 80], "forwardPorts": [5173, 4173, 80],
"portsAttributes": { "portsAttributes": {
"3000": {
"label": "Static site (pnpm serve)",
"onAutoForward": "notify"
},
"80": { "80": {
"label": "Nginx (when running container)", "label": "Nginx (when running container)",
"onAutoForward": "silent" "onAutoForward": "silent"
},
"4173": {
"label": "Preview build (pnpm preview)",
"onAutoForward": "silent"
},
"5173": {
"label": "SvelteKit dev (pnpm dev)",
"onAutoForward": "notify"
} }
}, },
"customizations": { "customizations": {
@@ -21,13 +25,16 @@
"extensions": [ "extensions": [
"dbaeumer.vscode-eslint", "dbaeumer.vscode-eslint",
"esbenp.prettier-vscode", "esbenp.prettier-vscode",
"stylelint.vscode-stylelint" "stylelint.vscode-stylelint",
"svelte.svelte-vscode"
], ],
"settings": { "settings": {
"editor.formatOnSave": true, "editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode", "editor.defaultFormatter": "esbenp.prettier-vscode",
"[css]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[css]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[svelte]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[html]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[html]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"editor.codeActionsOnSave": { "editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit", "source.fixAll.eslint": "explicit",

5
.gitignore vendored
View File

@@ -28,7 +28,10 @@ Thumbs.db
*.swo *.swo
*~ *~
# Build output (if added later) # SvelteKit
.svelte-kit
# Build output
dist dist
build build
.next .next

View File

@@ -3,13 +3,9 @@
"singleQuote": true, "singleQuote": true,
"tabWidth": 4, "tabWidth": 4,
"trailingComma": "all", "trailingComma": "all",
"plugins": ["prettier-plugin-svelte"],
"overrides": [ "overrides": [
{ { "files": "*.yml", "options": { "tabWidth": 4, "proseWrap": "preserve" } },
"files": "*.yml", { "files": "*.svelte", "options": { "parser": "svelte" } }
"options": {
"tabWidth": 4,
"proseWrap": "preserve"
}
}
] ]
} }

View File

@@ -50,6 +50,16 @@ steps:
depends_on: depends_on:
- install - install
- name: check
image: node:22-alpine
commands:
- corepack enable
- corepack prepare pnpm@10.29.2 --activate
- pnpm install --frozen-lockfile
- pnpm check
depends_on:
- install
- name: Send Prettier Status Notification (failure) - name: Send Prettier Status Notification (failure)
image: curlimages/curl image: curlimages/curl
environment: environment:
@@ -85,5 +95,6 @@ steps:
- install - install
- lint - lint
- format check - format check
- check
when: when:
- status: [success] - status: [success]

53
AGENTS.md Normal file
View File

@@ -0,0 +1,53 @@
# AGENTS.md guidance for LLM agents
This file helps LLM agents work with the Armandine codebase without introducing antipatterns.
## Stack and goals
- **Svelte 5** + **SvelteKit** with **TypeScript**. The site is a **single pre-rendered page** (no SSR, no backend).
- **adapter-static**: the app is built to static HTML/JS/CSS in `build/`. The gallery is **rendered at build time** from `src/lib/media.ts`; the HTML already contains the full gallery. Lightbox and theme toggle are handled by a **client script** (`static/assets/js/script.js`) that binds to the pre-rendered DOM.
- **PostCSS**: nesting and CSS level 2; component-scoped `<style>` in Svelte where possible; global styles in `src/app.css`.
- **Critical CSS**: after `vite build`, `scripts/critical-css.js` runs Beasties to inline critical CSS into the built HTML.
## Structure
| What | Where |
|------|--------|
| Routes / page | `src/routes/` (`+page.svelte`, `+page.ts`, `+layout.svelte`, `+layout.ts`) |
| Components | `src/lib/components/` (e.g. `GalleryFigure.svelte`, `SiteHeader.svelte`) |
| Media data (build-time gallery) | `src/lib/media.ts` typed array; loaded in `+page.ts` and passed to the page |
| Client script (lightbox, theme) | `static/assets/js/script.js` not part of Svelte bundle; preloaded in head |
| GA init | `static/assets/js/ga-init.js` |
| Static assets (favicons, media files) | `static/assets/` (media: `desktop/`, `tablet/`, `mobile/`, `thumbnail/`, `videos/`) |
| Global CSS | `src/app.css` (imported in `+layout.svelte`) |
| Config | `svelte.config.js`, `vite.config.ts`, `tsconfig.json`, `postcss.config.js` |
## Conventions
- Use **Svelte 5** patterns (e.g. `$props()`, runes). Use **TypeScript** for `src/lib` and route logic.
- **Gallery**: Rendered at build time via `GalleryFigure` and `data.mediaItems` from `+page.ts`. Do not move gallery rendering to the client.
- **Lightbox and theme**: Implemented in `static/assets/js/script.js`; they rely on the pre-rendered DOM (e.g. `.gallery-item`, `#lightbox`, `#lb-content`). Keep them in that script; do not reimplement in Svelte for “consistency” (the plan keeps them in JS for optimal loading and preload).
- **Head**: Metadata, JSON-LD, favicons, preload of `script.js`, and GA scripts are set in `+page.svelte`s `<svelte:head>`.
- **CSS**: Prefer component-scoped `<style>` in Svelte components; use `src/app.css` only for `:root`, `body`, and shared/global rules (e.g. lightbox, which is targeted by the client script).
- **Build**: `pnpm build` = `vite build` then `node scripts/critical-css.js`. Output is `build/`. Dockerfile copies `build/` into the image.
## Build pipeline and CI
- **Local:** `pnpm dev` (dev server), `pnpm build` (production build), `pnpm preview` (serve `build/`), `pnpm check` (Svelte + TypeScript check).
- **CI (Woodpecker):** `ci` runs lint, format:check, and **check** (Svelte/TS). `build` runs `pnpm build` then `docker build` (image uses `build/`).
## Antipatterns to avoid
- **Do not** add a backend, API routes, or SSR for this static site.
- **Do not** move lightbox or theme logic into Svelte components; they stay in `static/assets/js/script.js` and attach to the pre-rendered DOM.
- **Do not** add unscoped global CSS for component-specific styles; use component `<style>` or the existing `app.css` sections.
- **Do not** introduce dynamic routes or server-dependent behavior that would break static export (adapter-static).
- **Do not** remove or bypass the Beasties critical-CSS step without replacing it with an equivalent (e.g. another inlining strategy).
## How to add features
- **New media item:** Add an entry to the `mediaItems` array in `src/lib/media.ts` (type, name, caption, alt, dimensions, loading/fetchpriority as needed). Ensure the corresponding files exist under `static/assets/media/` (desktop, tablet, mobile, thumbnail; videos in `videos/`).
- **New component:** Add a `.svelte` file under `src/lib/components/` (or a subfolder). Use component-scoped `<style>` and PostCSS will process it. Export and use in the appropriate route or parent component.
- **New page:** Add a route under `src/routes/` (e.g. `src/routes/about/+page.svelte` and `+page.ts` if needed). With `prerender = true` in the root layout, all pages are pre-rendered.
- **Change metadata or JSON-LD:** Edit the `<svelte:head>` block in `src/routes/+page.svelte` (or the relevant page). Update the `jsonLd` object and meta tags as needed.
- **Change client behavior (lightbox/theme):** Edit `static/assets/js/script.js`. Ensure the script still targets the same DOM structure (e.g. `.gallery-item`, `data-name`, `data-type`, `data-caption`, `#lightbox`, `#lb-content`, `#lb-caption`, `#lb-close`, `#show_video`, `#theme-toggle`).

View File

@@ -1,4 +1,4 @@
FROM nginx:alpine FROM nginx:alpine
COPY nginx/conf.d/ /etc/nginx/conf.d/ COPY nginx/conf.d/ /etc/nginx/conf.d/
COPY dist/ /usr/share/nginx/html/ COPY build/ /usr/share/nginx/html/

View File

@@ -1,21 +1,28 @@
# Armandine # Armandine
Static gallery site served by Nginx. Runs as a repository-based container; image is built and pushed via Woodpecker CI/CD from this repo. Pre-rendered Svelte gallery site served by Nginx. Build outputs to `build/`; image is built and pushed via Woodpecker CI/CD from this repo.
## Stack ## Stack
- **Site:** Static HTML/CSS/JS in `src/`, copied into the image. - **Site:** Svelte 5 + SvelteKit (TypeScript), `@sveltejs/adapter-static`. Gallery is rendered at build time from `src/lib/media.ts`; lightbox and theme toggle run from a preloaded client script (`static/assets/js/script.js`).
- **Runtime:** `nginx:alpine` (see `Dockerfile`). - **CSS:** PostCSS (nesting + level 2), component-scoped styles; critical CSS inlined at build time with Beasties.
- **Runtime:** `nginx:alpine` (see `Dockerfile`) serves the contents of `build/`.
- **Registry:** Gitea at `git.mifi.dev` → image `git.mifi.dev/mifi-holdings/armandine`. - **Registry:** Gitea at `git.mifi.dev` → image `git.mifi.dev/mifi-holdings/armandine`.
- **Deploy:** Portainer on Linode; stack uses this image (no volume for site content). - **Deploy:** Portainer on Linode; stack uses this image (no volume for site content).
## Local development ## Local development
```bash ```bash
# Install dev dependencies (ESLint, Prettier, Stylelint) # Install dependencies
pnpm install pnpm install
# Lint JS and CSS # Dev server with hot reload (http://localhost:5173)
pnpm dev
# Type-check (Svelte + TypeScript)
pnpm check
# Lint JS/TS and CSS
pnpm lint pnpm lint
# Check formatting (CI uses this) # Check formatting (CI uses this)
@@ -24,8 +31,11 @@ pnpm format:check
# Fix formatting # Fix formatting
pnpm format pnpm format
# Preview site locally (serves src/ on http://localhost:3000) # Build for production (Vite + critical CSS step)
pnpm serve pnpm build
# Preview the built site (http://localhost:4173)
pnpm preview
``` ```
## Dev container ## Dev container
@@ -34,29 +44,32 @@ Open the repo in a dev container (VS Code/Cursor: **Dev Containers: Reopen in Co
- **Node 22** (matches CI), with `pnpm install` run after create - **Node 22** (matches CI), with `pnpm install` run after create
- **Docker (outside of Docker)** uses the host Docker socket so you can run `pnpm build` and test the image inside the dev container - **Docker (outside of Docker)** uses the host Docker socket so you can run `pnpm build` and test the image inside the dev container
- **ESLint, Prettier, Stylelint** extensions plus format-on-save and fix-on-save - **ESLint, Prettier, Stylelint, Svelte** extensions plus format-on-save and fix-on-save
Port **3000** is forwarded for `pnpm serve`; port **80** is forwarded if you run the built Nginx container locally. Ports:
- **5173** SvelteKit dev server (`pnpm dev`)
- **4173** Preview built site (`pnpm preview`)
- **80** Nginx when running the Docker container locally
## Manual build and push ## Manual build and push
When you want to build and push the image yourself (e.g. before CI was set up, or for a one-off deploy):
1. Log in to the Gitea container registry: 1. Log in to the Gitea container registry:
```bash ```bash
docker login git.mifi.dev docker login git.mifi.dev
``` ```
Use your Gitea username and a token with package permissions. Use your Gitea username and a token with package permissions.
2. Build the image (tags as `latest`): 2. Build the site and Docker image:
```bash ```bash
pnpm build pnpm build
pnpm docker:build
``` ```
This runs: `docker build -t git.mifi.dev/mifi-holdings/armandine:latest .` `pnpm build` runs Vite build then Beasties to inline critical CSS into `build/`. The Dockerfile copies `build/` into the image.
3. Push to the registry: 3. Push to the registry:
```bash ```bash
pnpm push pnpm docker:push
``` ```
Then on the server, redeploy the stack (e.g. Portainer “Pull and redeploy” or your webhook). Then on the server, redeploy the stack (e.g. Portainer “Pull and redeploy” or your webhook).
@@ -66,8 +79,8 @@ Three pipelines (see `.woodpecker/`):
| Pipeline | When | What | | Pipeline | When | What |
|----------|------|------| |----------|------|------|
| **ci** | Every push to `main`, every PR | Lint (ESLint + Stylelint) and Prettier check | | **ci** | Every push to `main`, every PR | Lint (ESLint + Stylelint), Prettier check, Svelte/TypeScript check |
| **build**| Push/tag/manual on `main` only (after ci) | Build Docker image, push to `git.mifi.dev/mifi-holdings/armandine` | | **build**| Push/tag/manual on `main` only (after ci) | Build site to `build/`, build Docker image, push to `git.mifi.dev/mifi-holdings/armandine` |
| **deploy** | After build | Trigger Portainer stack redeploy via webhook | | **deploy** | After build | Trigger Portainer stack redeploy via webhook |
Order: **ci** → **build** → **deploy**. Order: **ci** → **build** → **deploy**.
@@ -79,32 +92,50 @@ Configure in the repos Woodpecker secrets:
- `gitea_registry_username` Gitea user for registry login - `gitea_registry_username` Gitea user for registry login
- `gitea_package_token` Gitea token with package read/write - `gitea_package_token` Gitea token with package read/write
- `portainer_webhook_url` Portainer stack webhook URL for redeploy - `portainer_webhook_url` Portainer stack webhook URL for redeploy
- `discord_webhook_url` (optional) Discord notifications for build/deploy status - Mattermost/Discord webhook secrets (see `.woodpecker/*.yaml` for notifications)
## Server / Portainer ## Server / Portainer
- Stack is defined by `docker-compose.yml` in this repo. - Stack is defined by `docker-compose.yml` in this repo.
- Compose uses the image from the registry (`git.mifi.dev/mifi-holdings/armandine:latest`); no volume for site content (its inside the image). - Compose uses the image from the registry (`git.mifi.dev/mifi-holdings/armandine:latest`); no volume for site content (its inside the image).
- Ensure the server can pull from `git.mifi.dev` (login or registry access). After a push, either let the deploy pipeline trigger the Portainer webhook or manually “Pull and redeploy” the stack. - Ensure the server can pull from `git.mifi.dev`. After a push, either let the deploy pipeline trigger the Portainer webhook or manually “Pull and redeploy” the stack.
## Project layout ## Project layout
``` ```
├── src/ # Static site (copied into image) ├── src/
│ ├── index.html │ ├── app.html # SvelteKit HTML template
│ ├── app.css # Global CSS (variables, body, lightbox)
│ ├── app.d.ts # App types
│ ├── routes/
│ │ ├── +layout.svelte
│ │ ├── +layout.ts # prerender = true
│ │ ├── +page.svelte # Main page (header, gallery, lightbox markup)
│ │ └── +page.ts # Loads media data for build-time gallery
│ └── lib/
│ ├── media.ts # Typed gallery media list (used at build time)
│ └── components/
│ ├── GalleryFigure.svelte
│ └── SiteHeader.svelte
├── static/ # Copied as-is to build root
│ ├── robots.txt
│ └── assets/ │ └── assets/
│ ├── css/ │ ├── js/ # script.js (lightbox, theme), ga-init.js
│ ├── js/ │ ├── media/ # desktop/, tablet/, mobile/, thumbnail/, videos/
│ └── media/ │ └── favicon*.png, favicon.ico
├── Dockerfile # nginx:alpine + COPY src → /usr/share/nginx/html ├── scripts/
├── docker-compose.yml # Stack for Portainer (Traefik, healthcheck) │ └── critical-css.js # Beasties post-step on build/
├── package.json # Scripts: build, push, lint, format, serve (pnpm) ├── build/ # Output of pnpm build (Vite + Beasties)
├── .devcontainer/ # Dev container (Node 22, Docker, lint/format tools) ├── Dockerfile # nginx:alpine + COPY build/
├── docker-compose.yml
├── package.json # Scripts: dev, build, preview, check, lint, format
├── .devcontainer/
├── .woodpecker/ ├── .woodpecker/
│ ├── ci.yaml # Lint + format check (PR + main) │ ├── ci.yaml
│ ├── build.yaml # Build image, push to registry │ ├── build.yaml
│ └── deploy.yaml # Portainer webhook │ └── deploy.yaml
── README.md # This file ── README.md
└── AGENTS.md # Guidance for LLM agents
``` ```
## Version ## Version

View File

@@ -1,28 +1,26 @@
import prettierConfig from 'eslint-config-prettier/flat' import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import prettierConfig from 'eslint-config-prettier/flat';
export default [ export default [
{ ignores: ['**/*.d.ts'] },
eslint.configs.recommended,
...tseslint.configs.recommended,
{ {
files: ['src/**/*.js'], files: ['src/**/*.ts', 'src/**/*.js'],
languageOptions: { languageOptions: {
ecmaVersion: 'latest', ecmaVersion: 'latest',
sourceType: 'script', sourceType: 'module',
globals: { globals: {
window: 'readonly', window: 'readonly',
document: 'readonly', document: 'readonly'
dataLayer: 'writable'
} }
}, },
rules: { rules: {
'no-undef': 'warn', 'no-unused-vars': 'off',
'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }], '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'no-var': 'warn', 'prefer-const': 'warn'
'prefer-arrow-callback': 'warn',
'prefer-const': 'warn',
'prefer-destructuring': 'warn',
'prefer-rest-params': 'warn',
'prefer-spread': 'warn',
'prefer-template': 'warn',
} }
}, },
prettierConfig prettierConfig
] ];

View File

@@ -4,34 +4,47 @@
"type": "module", "type": "module",
"private": true, "private": true,
"packageManager": "pnpm@10.29.3+sha512.498e1fb4cca5aa06c1dcf2611e6fafc50972ffe7189998c409e90de74566444298ffe43e6cd2acdc775ba1aa7cc5e092a8b7054c811ba8c5770f84693d33d2dc", "packageManager": "pnpm@10.29.3+sha512.498e1fb4cca5aa06c1dcf2611e6fafc50972ffe7189998c409e90de74566444298ffe43e6cd2acdc775ba1aa7cc5e092a8b7054c811ba8c5770f84693d33d2dc",
"description": "Armandine gallery static Nginx site", "description": "Armandine gallery pre-rendered Svelte site",
"scripts": { "scripts": {
"build": "node scripts/build.js", "dev": "vite dev",
"docker:build": "docker build --platform linux/amd64 -t git.mifi.dev/mifi-holdings/landing:latest .", "build": "vite build && node scripts/critical-css.js",
"docker:push": "docker push git.mifi.dev/mifi-holdings/landing:latest", "preview": "vite preview",
"format": "prettier --write \"src/**/*.{html,css,js,json}\"", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"format:check": "prettier --check \"src/**/*.{html,css,js,json}\"", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"format": "prettier --write \"src/**/*.{ts,js,svelte,css,json}\" \"static/**/*.js\"",
"format:check": "prettier --check \"src/**/*.{ts,js,svelte,css,json}\" \"static/**/*.js\"",
"lint": "pnpm run lint:yaml && pnpm run lint:js && pnpm run lint:css", "lint": "pnpm run lint:yaml && pnpm run lint:js && pnpm run lint:css",
"lint:css": "stylelint \"src/**/*.css\"", "lint:css": "stylelint \"src/**/*.css\"",
"lint:js": "eslint src/", "lint:js": "eslint src/",
"lint:yaml": "yamllint .woodpecker/ci.yml .woodpecker/build.yml .woodpecker/deploy.yml docker-compose.yml", "lint:yaml": "yamllint .woodpecker/ci.yaml .woodpecker/build.yaml .woodpecker/deploy.yaml docker-compose.yml",
"lint:fix": "pnpm run lint:fix:js && pnpm run lint:fix:css && pnpm run lint:fix:yaml", "lint:fix": "pnpm run lint:fix:js && pnpm run lint:fix:css && pnpm run lint:fix:yaml",
"lint:fix:js": "eslint src/ --fix", "lint:fix:js": "eslint src/ --fix",
"lint:fix:css": "stylelint \"src/**/*.css\" --fix", "lint:fix:css": "stylelint \"src/**/*.css\" --fix",
"lint:fix:yaml": "yamllint .woodpecker/ci.yml .woodpecker/build.yml .woodpecker/deploy.yml docker-compose.yml --fix", "lint:fix:yaml": "yamllint .woodpecker/ci.yaml .woodpecker/build.yaml .woodpecker/deploy.yaml docker-compose.yml --fix",
"preview": "serve src -l 3000", "docker:build": "docker build --platform linux/amd64 -t git.mifi.dev/mifi-holdings/armandine:latest .",
"preview:prod": "pnpm build && serve dist -l 3000" "docker:push": "docker push git.mifi.dev/mifi-holdings/armandine:latest"
}, },
"devDependencies": { "devDependencies": {
"clean-css": "^5.3.3", "@sveltejs/adapter-static": "^3.0.1",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^6.2.4",
"beasties": "^0.4.1", "beasties": "^0.4.1",
"@eslint/js": "^10.0.1",
"eslint": "^10.0.0", "eslint": "^10.0.0",
"eslint-config-prettier": "^10.1.8", "eslint-config-prettier": "^10.1.8",
"typescript-eslint": "^8.0.0",
"postcss": "^8.4.49",
"postcss-load-config": "^6.0.0",
"postcss-nesting": "^14.0.0",
"postcss-preset-env": "^11.1.3",
"prettier": "^3.4.2", "prettier": "^3.4.2",
"serve": "^14.2.4", "prettier-plugin-svelte": "^3.2.0",
"stylelint": "^17.3.0", "stylelint": "^17.3.0",
"stylelint-config-standard": "^40.0.0", "stylelint-config-standard": "^40.0.0",
"terser": "^5.46.0", "svelte": "^5.0.0",
"svelte-check": "^4.0.0",
"typescript": "^5.0.0",
"vite": "^7.3.1",
"yaml-lint": "^1.7.0" "yaml-lint": "^1.7.0"
} }
} }

2694
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

9
postcss.config.js Normal file
View File

@@ -0,0 +1,9 @@
export default {
plugins: {
'postcss-nesting': {},
'postcss-preset-env': {
stage: 2,
features: { 'nesting-rules': false }
}
}
};

View File

@@ -1,78 +0,0 @@
/**
* Build script: copy src → dist, minify JS/CSS, inline critical CSS (Beasties).
* Run with: pnpm build
*/
import {
rmSync,
mkdirSync,
readFileSync,
writeFileSync,
cpSync,
readdirSync
} from 'fs'
import { join, dirname, extname } from 'path'
import { fileURLToPath } from 'url'
import Beasties from 'beasties'
import { minify as minifyJs } from 'terser'
import CleanCSS from 'clean-css'
const __dirname = dirname(fileURLToPath(import.meta.url))
const root = join(__dirname, '..')
const srcDir = join(root, 'src')
const distDir = join(root, 'dist')
function getFiles(dir, files = []) {
const entries = readdirSync(dir, { withFileTypes: true })
for (const e of entries) {
const full = join(dir, e.name)
if (e.isDirectory()) getFiles(full, files)
else files.push(full)
}
return files
}
async function main() {
// 1. Clean and copy src → dist
rmSync(distDir, { recursive: true, force: true })
mkdirSync(distDir, { recursive: true })
cpSync(srcDir, distDir, { recursive: true })
const distFiles = getFiles(distDir)
// 2. Minify JS
const jsFiles = distFiles.filter((f) => extname(f) === '.js')
for (const f of jsFiles) {
const code = readFileSync(f, 'utf8')
const result = await minifyJs(code, { format: { comments: false } })
if (result.code) writeFileSync(f, result.code)
}
// 3. Minify CSS
const cleanCss = new CleanCSS({ level: 2 })
const cssFiles = distFiles.filter((f) => extname(f) === '.css')
for (const f of cssFiles) {
const code = readFileSync(f, 'utf8')
const result = cleanCss.minify(code)
if (!result.errors.length) writeFileSync(f, result.styles)
}
// 4. Inline critical CSS with Beasties for all HTML files (no browser; works in CI)
const htmlFiles = distFiles.filter((f) => extname(f) === '.html')
const beasties = new Beasties({
path: distDir,
preload: 'default',
logLevel: 'warn'
})
for (const htmlFile of htmlFiles) {
const html = readFileSync(htmlFile, 'utf8')
const inlined = await beasties.process(html)
writeFileSync(htmlFile, inlined)
}
console.log('Build complete: dist/')
}
main().catch((err) => {
console.error(err)
process.exit(1)
})

40
scripts/critical-css.js Normal file
View File

@@ -0,0 +1,40 @@
/**
* Inline critical CSS into built HTML using Beasties.
* Run after vite build; reads/writes build/.
*/
import { readFileSync, writeFileSync, readdirSync } from 'fs';
import { join, dirname } from 'path';
import { fileURLToPath } from 'url';
import Beasties from 'beasties';
const __dirname = dirname(fileURLToPath(import.meta.url));
const buildDir = join(__dirname, '..', 'build');
function getFiles(dir, ext, files = []) {
for (const name of readdirSync(dir, { withFileTypes: true })) {
const full = join(dir, name.name);
if (name.isDirectory()) getFiles(full, ext, files);
else if (name.name.endsWith(ext)) files.push(full);
}
return files;
}
const beasties = new Beasties({
path: buildDir,
preload: 'default',
logLevel: 'warn'
});
async function main() {
const htmlFiles = getFiles(buildDir, '.html');
for (const htmlFile of htmlFiles) {
const html = readFileSync(htmlFile, 'utf8');
const inlined = await beasties.process(html);
writeFileSync(htmlFile, inlined);
}
console.log('Critical CSS inlined:', htmlFiles.length, 'file(s)');
}
main().catch((err) => {
console.error(err);
process.exit(1);
});

99
src/app.css Normal file
View File

@@ -0,0 +1,99 @@
:root {
--bg: #fff;
--fg: #222;
--accent: #007acc;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #111;
--fg: #eee;
--accent: #46c;
}
}
/* Explicit theme toggle overrides (win over media query when set) */
html.dark {
--bg: #111;
--fg: #eee;
--accent: #46c;
}
html.light {
--bg: #fff;
--fg: #222;
--accent: #007acc;
}
body {
margin: 0;
font-family: sans-serif;
background-color: var(--bg);
color: var(--fg);
}
.lightbox-open {
overflow: hidden;
}
.gallery-grid {
column-count: 1;
column-gap: 1rem;
padding: 1rem;
}
@media (width >= 768px) {
.gallery-grid {
column-count: 2;
}
}
@media (width >= 1024px) {
.gallery-grid {
column-count: 3;
}
}
/* Lightbox: not a Svelte component, styled globally for script.js target */
#lightbox {
position: fixed;
inset: 0;
background: rgb(0 0 0 / 90%);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
visibility: hidden;
opacity: 0;
transition: opacity 0.3s;
}
#lightbox[aria-hidden='false'] {
visibility: visible;
opacity: 1;
}
#lb-content img,
#lb-content video {
max-width: 90vw;
max-height: 80vh;
border-radius: 8px;
}
#lb-caption {
color: #fff;
margin-top: 0.5rem;
text-align: center;
max-width: 90vw;
}
#lb-close {
position: absolute;
top: 1rem;
right: 1rem;
background: none;
border: none;
font-size: 2rem;
color: #fff;
cursor: pointer;
}

13
src/app.d.ts vendored Normal file
View File

@@ -0,0 +1,13 @@
// See https://svelte.dev/docs/kit/types#app.d.ts
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface PageState {}
// interface Platform {}
}
}
export {};

10
src/app.html Normal file
View File

@@ -0,0 +1,10 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>

View File

@@ -1,147 +0,0 @@
:root {
--bg: #fff;
--fg: #222;
--accent: #007acc;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #111;
--fg: #eee;
--accent: #46c;
}
}
/* Explicit theme toggle overrides (win over media query when set) */
html.dark {
--bg: #111;
--fg: #eee;
--accent: #46c;
}
html.light {
--bg: #fff;
--fg: #222;
--accent: #007acc;
}
body {
margin: 0;
font-family: sans-serif;
background-color: var(--bg);
color: var(--fg);
}
.lightbox-open {
overflow: hidden;
}
.site-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem;
background: var(--bg);
border-bottom: 1px solid #ccc;
}
.emoji-button {
background: none;
border: none;
font-size: 1.5rem;
cursor: pointer;
color: var(--accent);
}
.gallery-grid {
column-count: 1;
column-gap: 1rem;
padding: 1rem;
}
@media (width >= 768px) {
.gallery-grid {
column-count: 2;
}
}
@media (width >= 1024px) {
.gallery-grid {
column-count: 3;
}
}
.gallery-item {
aspect-ratio: 3/2;
margin: 0 0 1rem;
position: relative;
cursor: pointer;
}
.gallery-item img {
height: auto;
width: 100%;
display: block;
border-radius: 8px;
}
.gallery-item figcaption {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
padding: 0.5rem;
background: rgb(0 0 0 / 60%);
color: #fff;
font-size: 0.9rem;
opacity: 0;
transition: opacity 0.2s;
}
.gallery-item:focus figcaption,
.gallery-item:hover figcaption {
opacity: 1;
}
#lightbox {
position: fixed;
inset: 0;
background: rgb(0 0 0 / 90%);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
visibility: hidden;
opacity: 0;
transition: opacity 0.3s;
}
#lightbox[aria-hidden='false'] {
visibility: visible;
opacity: 1;
}
#lb-content img,
#lb-content video {
max-width: 90vw;
max-height: 80vh;
border-radius: 8px;
}
#lb-caption {
color: #fff;
margin-top: 0.5rem;
text-align: center;
max-width: 90vw;
}
#lb-close {
position: absolute;
top: 1rem;
right: 1rem;
background: none;
border: none;
font-size: 2rem;
color: #fff;
cursor: pointer;
}

View File

@@ -1,120 +0,0 @@
// --- theme toggle ---
const toggle = document.getElementById('theme-toggle');
const root = document.documentElement;
const saved = window?.localStorage?.getItem('dark-mode');
const sysDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
if (saved === 'true') {
root.classList.add('dark');
root.classList.remove('light');
} else if (saved === 'false') {
root.classList.add('light');
root.classList.remove('dark');
} else {
if (sysDark) {
root.classList.add('dark');
root.classList.remove('light');
} else {
root.classList.add('light');
root.classList.remove('dark');
}
}
toggle.addEventListener('click', () => {
const isDark = root.classList.contains('dark');
root.classList.toggle('dark', !isDark);
root.classList.toggle('light', isDark);
window?.localStorage?.setItem('dark-mode', !isDark);
});
const { body } = document;
// --- lightbox base ---
const lb = document.getElementById('lightbox');
const lbCnt = document.getElementById('lb-content');
const lbCap = document.getElementById('lb-caption');
document.getElementById('lb-close').addEventListener('click', () => {
lb.setAttribute('aria-hidden', 'true');
body.classList.remove('lightbox-open');
lbCnt.innerHTML = '';
});
// --- build gallery ---
const gallery = document.getElementById('gallery');
const mediaData = JSON.parse(document.getElementById('media-data').textContent);
const createPicture = (item) => {
const pic = document.createElement('picture');
['desktop', 'tablet', 'mobile'].forEach((bp) => {
const src = document.createElement('source');
const widthQuery = bp === 'desktop' ? 1024 : bp === 'tablet' ? 768 : 0;
src.media = `(min-width:${widthQuery}px)`;
if (item.type === 'image') {
src.srcset =
`assets/media/${bp}/${item.name}@1x.webp 1x, ` +
`assets/media/${bp}/${item.name}.webp 2x`;
} else {
// video poster still
src.srcset =
`assets/media/${bp}/${item.name}_still@1x.webp 1x, ` +
`assets/media/${bp}/${item.name}_still.webp 2x`;
}
pic.appendChild(src);
});
// thumbnail fallback (always 300px/2×)
const img = document.createElement('img');
img.src = `assets/media/thumbnail/${item.name}.webp`;
img.alt = item.alt.replace(/[]/g, '');
img.height = item.height || undefined;
img.width = item.width || undefined;
img.loading = item.loading || 'lazy';
img.fetchPriority = item.fetchpriority || undefined;
pic.appendChild(img);
return pic;
};
mediaData.forEach((item) => {
const fig = document.createElement('figure');
fig.className = `gallery-item${item.type === 'video' ? ' video' : ''}`;
fig.tabIndex = 0;
fig.dataset.name = item.name;
fig.dataset.type = item.type;
fig.dataset.caption = item.caption;
fig.appendChild(createPicture(item));
// overlay caption
const cap = document.createElement('figcaption');
cap.textContent = item.caption;
fig.appendChild(cap);
// events
fig.addEventListener('click', () => openLightbox(item));
fig.addEventListener(
'keypress',
(e) => e.key === 'Enter' && openLightbox(item),
);
gallery.appendChild(fig);
});
// --- video toggle ---
const videoTgl = document.getElementById('show_video');
videoTgl.addEventListener('click', () => {
openLightbox(mediaData.find((i) => i.type === 'video'));
});
function openLightbox(item) {
lbCnt.innerHTML = '';
if (item.type === 'video') {
const v = document.createElement('video');
v.src = `assets/media/videos/${item.name}.mp4`;
v.controls = true;
v.autoplay = true;
v.loading = item.loading || 'lazy';
lbCnt.appendChild(v);
} else {
lbCnt.appendChild(createPicture(item));
}
lbCap.textContent = item.caption;
body.classList.add('lightbox-open');
lb.setAttribute('aria-hidden', 'false');
}

View File

@@ -1,246 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<!-- Google tag (gtag.js) -->
<script
async
src="https://www.googletagmanager.com/gtag/js?id=G-QZGFK4MDT4"
></script>
<script
defer
src="/assets/js/ga-init.js"
data-ga-id="G-QZGFK4MDT4"
></script>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>64 Armandine St #3 Boston, Massachusetts</title>
<meta
name="description"
content="An inviting blend of comfort and curated art—relaxation guaranteed."
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/assets/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="/assets/favicon-16x16.png"
/>
<link rel="icon" type="image/x-icon" href="/assets/favicon.ico" />
<link rel="stylesheet" href="/assets/css/style.css" />
</head>
<body>
<header class="site-header">
<h1>64 Armandine St #3 Boston, Massachusetts</h1>
<div class="buttons">
<button
id="show_video"
class="emoji-button"
aria-label="Show video tour"
>
🎥
</button>
<button
id="theme-toggle"
class="emoji-button"
aria-label="Toggle light/dark theme"
>
🌓
</button>
</div>
</header>
<main>
<section id="gallery" class="gallery-grid">
<!-- gallery items are injected here by script.js -->
</section>
</main>
<!-- Lightbox -->
<div id="lightbox" aria-hidden="true">
<button id="lb-close" aria-label="Close">&times;</button>
<div id="lb-content"></div>
<p id="lb-caption"></p>
</div>
<!-- Your media manifest: list each file (no extension), type, and caption -->
<script id="media-data" type="application/json">
[
{
"type": "image",
"name": "living_room_1",
"caption": "An inviting blend of comfort and curated art—relaxation guaranteed.",
"alt": "Sunny living room with stylish seating and vibrant artwork.",
"height": 200,
"width": 300,
"loading": "eager",
"fetchpriority": "high"
},
{
"type": "image",
"name": "living_room_2",
"caption": "Relaxation elevated—your stylish living space awaits.",
"alt": "Spacious living area featuring elegant furniture and tasteful decor.",
"height": 200,
"width": 300,
"fetchpriority": "high"
},
{
"type": "image",
"name": "kitchen",
"caption": "The culinary stage is set—snacking encouraged, style required.",
"alt": "Modern kitchen showcasing sleek appliances and contemporary design.",
"height": 200,
"width": 300
},
{
"type": "image",
"name": "bedroom_suite_1",
"caption": "A bedroom suite designed to make snoozing irresistible.",
"alt": "Inviting bedroom suite with cozy bedding and warm lighting.",
"height": 200,
"width": 300
},
{
"type": "image",
"name": "bedroom_suite_2",
"caption": "Style meets comfort—sleeping in has never been easier.",
"alt": "Comfortable bedroom suite with elegant decor and soft tones.",
"height": 200,
"width": 300
},
{
"type": "image",
"name": "bedroom_suite_3",
"caption": "Where dreams get stylish—a bedroom that feels like home.",
"alt": "Welcoming bedroom with soothing colors and inviting ambiance.",
"height": 200,
"width": 300
},
{
"type": "image",
"name": "guest_bath",
"caption": "Your personal spa experience—right down the hall.",
"alt": "Sophisticated guest bathroom with modern fixtures and clean lines.",
"height": 450,
"width": 300
},
{
"type": "image",
"name": "onsuite_1",
"caption": "Luxury meets practicality—your private ensuite awaits.",
"alt": "Private ensuite bathroom featuring contemporary design and premium finishes.",
"height": 450,
"width": 300,
"loading": "eager",
"fetchpriority": "high"
},
{
"type": "image",
"name": "onsuite_2",
"caption": "Everyday luxury, right at home—your ensuite oasis.",
"alt": "Elegant ensuite with sleek fixtures and stylish decor.",
"height": 200,
"width": 300
},
{
"type": "image",
"name": "laundry",
"caption": "Laundry day reimagined—functional never looked so good.",
"alt": "Modern laundry room with washer, dryer, and organized storage.",
"height": 450,
"width": 300
},
{
"type": "image",
"name": "coat_closet",
"caption": "Organized and chic—your entryway's best friend.",
"alt": "Convenient coat closet with tidy storage solutions.",
"height": 200,
"width": 300
},
{
"type": "image",
"name": "deck_1",
"caption": "Outdoor comfort, just steps away—morning coffee optional.",
"alt": "Sunny deck with cozy seating and pleasant outdoor views.",
"height": 450,
"width": 300
},
{
"type": "image",
"name": "deck_2",
"caption": "Your fresh-air escape—ideal for relaxing evenings.",
"alt": "Comfortable deck area perfect for unwinding or entertaining.",
"height": 200,
"width": 300
},
{
"type": "image",
"name": "exterior",
"caption": "Curb appeal perfected—your new favorite place starts here.",
"alt": "Attractive home exterior with inviting architecture.",
"height": 200,
"width": 300
},
{
"type": "image",
"name": "backyard_parking",
"caption": "Convenience meets privacy—your personal backyard parking spot.",
"alt": "Private backyard parking area offering secure convenience.",
"height": 200,
"width": 300
},
{
"type": "image",
"name": "office_fitness_guest_1",
"caption": "Productivity zone meets fitness corner—multitasking done right.",
"alt": "Dual-purpose room featuring office setup and fitness equipment.",
"height": 200,
"width": 300
},
{
"type": "image",
"name": "office_fitness_guest_2",
"caption": "Work, workout, or unwind—the room of endless possibilities.",
"alt": "Versatile office and fitness area with modern amenities.",
"height": 200,
"width": 300
},
{
"type": "image",
"name": "office_fitness_guest_3",
"caption": "Stay focused or get fit—you decide.",
"alt": "Functional space combining a workspace and home fitness area.",
"height": 200,
"width": 300
},
{
"type": "image",
"name": "office_fitness_guest_4",
"caption": "Room for every routine—your workspace meets wellness.",
"alt": "Stylish office area seamlessly integrated with fitness features.",
"height": 200,
"width": 300
},
{
"type": "video",
"name": "tour",
"caption": "Take the scenic route—explore your the home's highlights with a virtual walkthrough.",
"alt": "Video tour showcasing the property.",
"height": 534,
"width": 300
}
]
</script>
<script src="assets/js/script.js"></script>
</body>
</html>

View File

@@ -0,0 +1,83 @@
<script lang="ts">
import type { MediaItem } from '$lib/media.js';
interface Props {
index?: number;
item: MediaItem;
}
let { item, index }: Props = $props();
</script>
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
<figure
class="gallery-item{item.type === 'video' ? ' video' : ''}"
tabindex="0"
data-name={item.name}
data-type={item.type}
data-caption={item.caption}
>
<picture>
{#each [
{ bp: 'desktop', minWidth: 1024 },
{ bp: 'tablet', minWidth: 768 },
{ bp: 'mobile', minWidth: 0 }
] as breakpoint}
<source
media="(min-width:{breakpoint.minWidth}px)"
srcset={item.type === 'image'
? `/assets/media/${breakpoint.bp}/${item.name}@1x.webp 1x, /assets/media/${breakpoint.bp}/${item.name}.webp 2x`
: `/assets/media/${breakpoint.bp}/${item.name}_still@1x.webp 1x, /assets/media/${breakpoint.bp}/${item.name}_still.webp 2x`}
/>
{/each}
<img
src="/assets/media/thumbnail/{item.name}.webp"
alt={item.alt.replace(/['']/g, '')}
height={item.height ?? undefined}
width={item.width ?? undefined}
loading={index && index > 2 ? item.loading ?? 'lazy' : undefined}
fetchpriority={item.fetchpriority ?? undefined}
/>
</picture>
<figcaption>{item.caption}</figcaption>
</figure>
<style>
.gallery-item {
aspect-ratio: 3/2;
margin: 0 0 1rem;
position: relative;
cursor: pointer;
& img {
height: auto;
width: 100%;
display: block;
border-radius: 8px;
}
& figcaption {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
padding: 0.5rem;
background: rgb(0 0 0 / 60%);
color: #fff;
font-size: 0.9rem;
opacity: 0;
transition: opacity 0.2s;
}
&:focus-visible {
outline: 2px solid var(--accent);
}
&:focus,
&:hover {
& figcaption {
opacity: 1;
}
}
}
</style>

View File

@@ -0,0 +1,30 @@
<header class="site-header">
<h1>64 Armandine St #3 Boston, Massachusetts</h1>
<div class="buttons">
<button id="show_video" class="emoji-button" aria-label="Show video tour">
🎥
</button>
<button id="theme-toggle" class="emoji-button" aria-label="Toggle light/dark theme">
🌓
</button>
</div>
</header>
<style>
.site-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem;
background: var(--bg);
border-bottom: 1px solid #ccc;
}
.emoji-button {
background: none;
border: none;
font-size: 1.5rem;
cursor: pointer;
color: var(--accent);
}
</style>

178
src/lib/media.ts Normal file
View File

@@ -0,0 +1,178 @@
export interface MediaItem {
type: 'image' | 'video';
name: string;
caption: string;
alt: string;
height?: number;
width?: number;
loading?: 'lazy' | 'eager';
fetchpriority?: 'high' | 'low' | 'auto';
}
export const mediaItems: MediaItem[] = [
{
type: 'image',
name: 'living_room_1',
caption: 'An inviting blend of comfort and curated art—relaxation guaranteed.',
alt: 'Sunny living room with stylish seating and vibrant artwork.',
height: 200,
width: 300,
loading: 'eager',
fetchpriority: 'high'
},
{
type: 'image',
name: 'living_room_2',
caption: 'Relaxation elevated—your stylish living space awaits.',
alt: 'Spacious living area featuring elegant furniture and tasteful decor.',
height: 200,
width: 300,
fetchpriority: 'high'
},
{
type: 'image',
name: 'kitchen',
caption: 'The culinary stage is set—snacking encouraged, style required.',
alt: 'Modern kitchen showcasing sleek appliances and contemporary design.',
height: 200,
width: 300
},
{
type: 'image',
name: 'bedroom_suite_1',
caption: 'A bedroom suite designed to make snoozing irresistible.',
alt: 'Inviting bedroom suite with cozy bedding and warm lighting.',
height: 200,
width: 300
},
{
type: 'image',
name: 'bedroom_suite_2',
caption: 'Style meets comfort—sleeping in has never been easier.',
alt: 'Comfortable bedroom suite with elegant decor and soft tones.',
height: 200,
width: 300
},
{
type: 'image',
name: 'bedroom_suite_3',
caption: 'Where dreams get stylish—a bedroom that feels like home.',
alt: 'Welcoming bedroom with soothing colors and inviting ambiance.',
height: 200,
width: 300
},
{
type: 'image',
name: 'guest_bath',
caption: 'Your personal spa experience—right down the hall.',
alt: 'Sophisticated guest bathroom with modern fixtures and clean lines.',
height: 450,
width: 300
},
{
type: 'image',
name: 'onsuite_1',
caption: 'Luxury meets practicality—your private ensuite awaits.',
alt: 'Private ensuite bathroom featuring contemporary design and premium finishes.',
height: 450,
width: 300,
loading: 'eager',
fetchpriority: 'high'
},
{
type: 'image',
name: 'onsuite_2',
caption: 'Everyday luxury, right at home—your ensuite oasis.',
alt: 'Elegant ensuite with sleek fixtures and stylish decor.',
height: 200,
width: 300
},
{
type: 'image',
name: 'laundry',
caption: 'Laundry day reimagined—functional never looked so good.',
alt: 'Modern laundry room with washer, dryer, and organized storage.',
height: 450,
width: 300
},
{
type: 'image',
name: 'coat_closet',
caption: 'Organized and chic—your entryway\'s best friend.',
alt: 'Convenient coat closet with tidy storage solutions.',
height: 200,
width: 300
},
{
type: 'image',
name: 'deck_1',
caption: 'Outdoor comfort, just steps away—morning coffee optional.',
alt: 'Sunny deck with cozy seating and pleasant outdoor views.',
height: 450,
width: 300
},
{
type: 'image',
name: 'deck_2',
caption: 'Your fresh-air escape—ideal for relaxing evenings.',
alt: 'Comfortable deck area perfect for unwinding or entertaining.',
height: 200,
width: 300
},
{
type: 'image',
name: 'exterior',
caption: 'Curb appeal perfected—your new favorite place starts here.',
alt: 'Attractive home exterior with inviting architecture.',
height: 200,
width: 300
},
{
type: 'image',
name: 'backyard_parking',
caption: 'Convenience meets privacy—your personal backyard parking spot.',
alt: 'Private backyard parking area offering secure convenience.',
height: 200,
width: 300
},
{
type: 'image',
name: 'office_fitness_guest_1',
caption: 'Productivity zone meets fitness corner—multitasking done right.',
alt: 'Dual-purpose room featuring office setup and fitness equipment.',
height: 200,
width: 300
},
{
type: 'image',
name: 'office_fitness_guest_2',
caption: 'Work, workout, or unwind—the room of endless possibilities.',
alt: 'Versatile office and fitness area with modern amenities.',
height: 200,
width: 300
},
{
type: 'image',
name: 'office_fitness_guest_3',
caption: 'Stay focused or get fit—you decide.',
alt: 'Functional space combining a workspace and home fitness area.',
height: 200,
width: 300
},
{
type: 'image',
name: 'office_fitness_guest_4',
caption: 'Room for every routine—your workspace meets wellness.',
alt: 'Stylish office area seamlessly integrated with fitness features.',
height: 200,
width: 300
},
{
type: 'video',
name: 'tour',
caption: "Take the scenic route—explore your the home's highlights with a virtual walkthrough.",
alt: 'Video tour showcasing the property.',
height: 534,
width: 300
}
];

View File

@@ -0,0 +1,5 @@
<script lang="ts">
import '../app.css';
</script>
<slot />

1
src/routes/+layout.ts Normal file
View File

@@ -0,0 +1 @@
export const prerender = true;

68
src/routes/+page.svelte Normal file
View File

@@ -0,0 +1,68 @@
<script lang="ts">
import SiteHeader from '$lib/components/SiteHeader.svelte';
import GalleryFigure from '$lib/components/GalleryFigure.svelte';
interface Props {
data: { mediaItems: import('$lib/media.js').MediaItem[] };
}
let { data }: Props = $props();
const title = '64 Armandine St #3 Boston, Massachusetts';
const description =
'An inviting blend of comfort and curated art—relaxation guaranteed.';
const canonical = 'https://armandine.example.com'; // replace with real URL
const gaId = 'G-QZGFK4MDT4';
const jsonLd = {
'@context': 'https://schema.org',
'@type': 'Place',
name: title,
description,
address: {
'@type': 'PostalAddress',
streetAddress: '64 Armandine St #3',
addressLocality: 'Boston',
addressRegion: 'MA',
addressCountry: 'US'
}
};
</script>
<svelte:head>
<title>{title}</title>
<meta name="description" content={description} />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="canonical" href={canonical} />
<meta property="og:title" content={title} />
<meta property="og:description" content={description} />
<meta property="og:type" content="website" />
<meta property="og:url" content={canonical} />
<link rel="icon" type="image/png" sizes="32x32" href="/assets/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/assets/favicon-16x16.png" />
<link rel="icon" type="image/x-icon" href="/assets/favicon.ico" />
<link rel="preload" href="/assets/js/script.js" as="script" />
<script defer src="/assets/js/script.js"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id={gaId}"></script>
<script defer src="/assets/js/ga-init.js" data-ga-id={gaId}></script>
{@html `<script type="application/ld+json">${JSON.stringify(jsonLd)}</script>`}
</svelte:head>
<SiteHeader />
<main>
<section id="gallery" class="gallery-grid">
{#each data.mediaItems as item}
<GalleryFigure {item} />
{/each}
</section>
</main>
<div id="lightbox" aria-hidden="true">
<button id="lb-close" aria-label="Close">&times;</button>
<div id="lb-content"></div>
<p id="lb-caption"></p>
</div>

5
src/routes/+page.ts Normal file
View File

@@ -0,0 +1,5 @@
import { mediaItems } from '$lib/media.js';
export function load() {
return { mediaItems };
}

View File

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View File

Before

Width:  |  Height:  |  Size: 353 KiB

After

Width:  |  Height:  |  Size: 353 KiB

View File

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View File

Before

Width:  |  Height:  |  Size: 896 B

After

Width:  |  Height:  |  Size: 896 B

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

108
static/assets/js/script.js Normal file
View File

@@ -0,0 +1,108 @@
// --- theme toggle ---
const toggle = document.getElementById('theme-toggle');
const root = document.documentElement;
const saved = window?.localStorage?.getItem('dark-mode');
const sysDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
if (saved === 'true') {
root.classList.add('dark');
root.classList.remove('light');
} else if (saved === 'false') {
root.classList.add('light');
root.classList.remove('dark');
} else {
if (sysDark) {
root.classList.add('dark');
root.classList.remove('light');
} else {
root.classList.add('light');
root.classList.remove('dark');
}
}
toggle?.addEventListener('click', () => {
const isDark = root.classList.contains('dark');
root.classList.toggle('dark', !isDark);
root.classList.toggle('light', isDark);
window?.localStorage?.setItem('dark-mode', String(!isDark));
});
const { body } = document;
// --- lightbox base ---
const lb = document.getElementById('lightbox');
const lbCnt = document.getElementById('lb-content');
const lbCap = document.getElementById('lb-caption');
document.getElementById('lb-close')?.addEventListener('click', () => {
lb?.setAttribute('aria-hidden', 'true');
body.classList.remove('lightbox-open');
if (lbCnt) lbCnt.innerHTML = '';
});
// Build picture element for lightbox (name, type only)
function createPicture(name, type) {
const pic = document.createElement('picture');
const breakpoints = [
{ bp: 'desktop', minWidth: 1024 },
{ bp: 'tablet', minWidth: 768 },
{ bp: 'mobile', minWidth: 0 }
];
for (const { bp, minWidth } of breakpoints) {
const src = document.createElement('source');
src.media = `(min-width:${minWidth}px)`;
if (type === 'image') {
src.srcset =
`/assets/media/${bp}/${name}@1x.webp 1x, /assets/media/${bp}/${name}.webp 2x`;
} else {
src.srcset =
`/assets/media/${bp}/${name}_still@1x.webp 1x, /assets/media/${bp}/${name}_still.webp 2x`;
}
pic.appendChild(src);
}
const img = document.createElement('img');
img.src = `/assets/media/thumbnail/${name}.webp`;
img.alt = '';
pic.appendChild(img);
return pic;
}
function openLightbox(item) {
if (!lbCnt || !lbCap || !lb) return;
lbCnt.innerHTML = '';
if (item.type === 'video') {
const v = document.createElement('video');
v.src = `/assets/media/videos/${item.name}.mp4`;
v.controls = true;
v.autoplay = true;
lbCnt.appendChild(v);
} else {
lbCnt.appendChild(createPicture(item.name, item.type));
}
lbCap.textContent = item.caption;
body.classList.add('lightbox-open');
lb.setAttribute('aria-hidden', 'false');
}
// --- bind to pre-rendered gallery ---
document.querySelectorAll('.gallery-item').forEach((fig) => {
const name = fig.getAttribute('data-name');
const type = fig.getAttribute('data-type');
const caption = fig.getAttribute('data-caption');
if (!name || !type || !caption) return;
const item = { name, type, caption };
fig.addEventListener('click', () => openLightbox(item));
fig.addEventListener('keydown', (e) => {
if (e.key === 'Enter') openLightbox(item);
});
});
// --- video toggle ---
const videoTgl = document.getElementById('show_video');
videoTgl?.addEventListener('click', () => {
const videoFig = document.querySelector('.gallery-item.video');
if (videoFig) {
openLightbox({
name: videoFig.getAttribute('data-name'),
type: videoFig.getAttribute('data-type'),
caption: videoFig.getAttribute('data-caption')
});
}
});

View File

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

Before

Width:  |  Height:  |  Size: 347 KiB

After

Width:  |  Height:  |  Size: 347 KiB

View File

Before

Width:  |  Height:  |  Size: 826 KiB

After

Width:  |  Height:  |  Size: 826 KiB

View File

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 130 KiB

View File

Before

Width:  |  Height:  |  Size: 903 KiB

After

Width:  |  Height:  |  Size: 903 KiB

View File

Before

Width:  |  Height:  |  Size: 146 KiB

After

Width:  |  Height:  |  Size: 146 KiB

View File

Before

Width:  |  Height:  |  Size: 637 KiB

After

Width:  |  Height:  |  Size: 637 KiB

View File

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 100 KiB

View File

Before

Width:  |  Height:  |  Size: 630 KiB

After

Width:  |  Height:  |  Size: 630 KiB

View File

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 92 KiB

View File

Before

Width:  |  Height:  |  Size: 494 KiB

After

Width:  |  Height:  |  Size: 494 KiB

View File

Before

Width:  |  Height:  |  Size: 135 KiB

After

Width:  |  Height:  |  Size: 135 KiB

View File

Before

Width:  |  Height:  |  Size: 618 KiB

After

Width:  |  Height:  |  Size: 618 KiB

View File

Before

Width:  |  Height:  |  Size: 167 KiB

After

Width:  |  Height:  |  Size: 167 KiB

View File

Before

Width:  |  Height:  |  Size: 294 KiB

After

Width:  |  Height:  |  Size: 294 KiB

View File

Before

Width:  |  Height:  |  Size: 142 KiB

After

Width:  |  Height:  |  Size: 142 KiB

View File

Before

Width:  |  Height:  |  Size: 315 KiB

After

Width:  |  Height:  |  Size: 315 KiB

View File

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 85 KiB

View File

Before

Width:  |  Height:  |  Size: 373 KiB

After

Width:  |  Height:  |  Size: 373 KiB

View File

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 64 KiB

View File

Before

Width:  |  Height:  |  Size: 1005 KiB

After

Width:  |  Height:  |  Size: 1005 KiB

View File

Before

Width:  |  Height:  |  Size: 188 KiB

After

Width:  |  Height:  |  Size: 188 KiB

View File

Before

Width:  |  Height:  |  Size: 538 KiB

After

Width:  |  Height:  |  Size: 538 KiB

View File

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 113 KiB

View File

Before

Width:  |  Height:  |  Size: 748 KiB

After

Width:  |  Height:  |  Size: 748 KiB

View File

Before

Width:  |  Height:  |  Size: 144 KiB

After

Width:  |  Height:  |  Size: 144 KiB

View File

Before

Width:  |  Height:  |  Size: 800 KiB

After

Width:  |  Height:  |  Size: 800 KiB

View File

Before

Width:  |  Height:  |  Size: 129 KiB

After

Width:  |  Height:  |  Size: 129 KiB

View File

Before

Width:  |  Height:  |  Size: 770 KiB

After

Width:  |  Height:  |  Size: 770 KiB

View File

Before

Width:  |  Height:  |  Size: 115 KiB

After

Width:  |  Height:  |  Size: 115 KiB

View File

Before

Width:  |  Height:  |  Size: 826 KiB

After

Width:  |  Height:  |  Size: 826 KiB

View File

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 126 KiB

View File

Before

Width:  |  Height:  |  Size: 688 KiB

After

Width:  |  Height:  |  Size: 688 KiB

View File

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

View File

Before

Width:  |  Height:  |  Size: 423 KiB

After

Width:  |  Height:  |  Size: 423 KiB

View File

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

View File

Before

Width:  |  Height:  |  Size: 176 KiB

After

Width:  |  Height:  |  Size: 176 KiB

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

Before

Width:  |  Height:  |  Size: 127 KiB

After

Width:  |  Height:  |  Size: 127 KiB

View File

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

View File

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 137 KiB

After

Width:  |  Height:  |  Size: 137 KiB

View File

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

View File

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 74 KiB

View File

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Some files were not shown because too many files have changed in this diff Show More