sv 1.1.1 → 1.3.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 (35) hide show
  1. package/dist/{shared.json → addons/ai-tools.json} +18 -199
  2. package/dist/{addons-DaktRhvH.mjs → addons-BCioxI2r.mjs} +134 -53
  3. package/dist/bin.mjs +39 -27
  4. package/dist/{engine-CpcTzL2R.mjs → engine-S8UpCG24.mjs} +81 -119
  5. package/dist/{engine-BLZdMrao.d.mts → engine-fNvU_-IL.d.mts} +3 -2
  6. package/dist/playground/PlaygroundLayout.svelte +218 -0
  7. package/dist/src/index.d.mts +36 -6
  8. package/dist/src/index.mjs +2 -2
  9. package/dist/src/testing.d.mts +1 -1
  10. package/dist/src/testing.mjs +1 -1
  11. package/dist/templates/addon/assets/CONTRIBUTING.md +48 -0
  12. package/dist/templates/addon/assets/README.md +29 -0
  13. package/dist/templates/addon/files.types=checkjs.json +10 -1
  14. package/dist/templates/addon/files.types=none.json +10 -1
  15. package/dist/templates/addon/files.types=typescript.json +10 -1
  16. package/dist/templates/addon/package.json +22 -16
  17. package/dist/templates/demo/assets/README.md +49 -0
  18. package/dist/templates/demo/files.types=checkjs.json +12 -0
  19. package/dist/templates/demo/files.types=none.json +12 -0
  20. package/dist/templates/demo/files.types=typescript.json +12 -0
  21. package/dist/templates/demo/package.json +11 -7
  22. package/dist/templates/library/assets/README.md +72 -0
  23. package/dist/templates/library/files.types=checkjs.json +12 -0
  24. package/dist/templates/library/files.types=none.json +12 -0
  25. package/dist/templates/library/files.types=typescript.json +12 -0
  26. package/dist/templates/library/package.json +29 -18
  27. package/dist/templates/minimal/assets/README.md +49 -0
  28. package/dist/templates/minimal/files.types=checkjs.json +12 -0
  29. package/dist/templates/minimal/files.types=none.json +12 -0
  30. package/dist/templates/minimal/files.types=typescript.json +12 -0
  31. package/dist/templates/minimal/package.json +11 -7
  32. package/package.json +4 -8
  33. package/dist/templates/demo/assets/DOT-npmrc +0 -1
  34. package/dist/templates/library/assets/DOT-npmrc +0 -1
  35. package/dist/templates/minimal/assets/DOT-npmrc +0 -1
@@ -9,9 +9,9 @@ import G from "node:readline";
9
9
  import { ReadStream } from "node:tty";
10
10
  import { EventEmitter } from "node:events";
11
11
  import childProcess, { spawn, spawnSync } from "node:child_process";
12
+ import { fileURLToPath } from "node:url";
12
13
  import { pipeline } from "node:stream/promises";
13
14
  import { PassThrough } from "node:stream";
14
- import { fileURLToPath } from "node:url";
15
15
  //#region \0rolldown/runtime.js
16
16
  var __create = Object.create;
17
17
  var __defProp = Object.defineProperty;
@@ -5020,7 +5020,7 @@ function safeParse(schema, input, config$1) {
5020
5020
  //#endregion
5021
5021
  //#region package.json
5022
5022
  var name = "sv";
5023
- var version = "1.1.1";
5023
+ var version = "1.3.0";
5024
5024
  //#endregion
5025
5025
  //#region src/core/errors.ts
5026
5026
  var UnsupportedError = class extends Error {
@@ -5046,7 +5046,8 @@ const PackageJSONSchema = /* @__PURE__ */ looseObject({
5046
5046
  /* @__PURE__ */ string(),
5047
5047
  /* @__PURE__ */ array(/* @__PURE__ */ string()),
5048
5048
  /* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ any$1())
5049
- ]))
5049
+ ])),
5050
+ scripts: /* @__PURE__ */ optional(StringRecordSchema)
5050
5051
  });
5051
5052
  const cliOptions = {
5052
5053
  noDownloadCheck: new Option("--no-download-check", "do not warn about downloads from community add-ons"),
@@ -5293,7 +5294,60 @@ function isNodeError(err) {
5293
5294
  return err instanceof Error;
5294
5295
  }
5295
5296
  //#endregion
5297
+ //#region ../../node_modules/.pnpm/empathic@2.0.1/node_modules/empathic/resolve.mjs
5298
+ /**
5299
+ * Resolve an absolute path from {@link root}, but only
5300
+ * if {@link input} isn't already absolute.
5301
+ *
5302
+ * @param input The path to resolve.
5303
+ * @param root The base path; default = process.cwd()
5304
+ * @returns The resolved absolute path.
5305
+ */
5306
+ function absolute(input, root) {
5307
+ return isAbsolute(input) ? input : resolve(root || ".", input);
5308
+ }
5309
+ function from(root, ident, silent) {
5310
+ try {
5311
+ let r = root instanceof URL || root.startsWith("file://") ? join(fileURLToPath(root), "noop.js") : join(absolute(root), "noop.js");
5312
+ return createRequire(r).resolve(ident);
5313
+ } catch (err) {
5314
+ if (!silent) throw err;
5315
+ }
5316
+ }
5317
+ //#endregion
5318
+ //#region ../../node_modules/.pnpm/empathic@2.0.1/node_modules/empathic/walk.mjs
5319
+ /**
5320
+ * Get all parent directories of {@link base}.
5321
+ * Stops after {@link Options['last']} is processed.
5322
+ *
5323
+ * @returns An array of absolute paths of all parent directories.
5324
+ */
5325
+ function up$1(base, options) {
5326
+ let { last, cwd } = options || {};
5327
+ let tmp = absolute(base, cwd);
5328
+ let root = absolute(last || "/", cwd);
5329
+ let prev, arr = [];
5330
+ while (prev !== root) {
5331
+ arr.push(tmp);
5332
+ tmp = dirname(prev = tmp);
5333
+ if (tmp === prev) break;
5334
+ }
5335
+ return arr;
5336
+ }
5337
+ //#endregion
5296
5338
  //#region src/create/utils.ts
5339
+ /**
5340
+ * @returns an absolute path to the `dist` directory
5341
+ * containing templates and add-on content
5342
+ *
5343
+ * this function can be called during runtime or devtime
5344
+ */
5345
+ const resolve_dist_dir = () => {
5346
+ const root = up$1(import.meta.dirname).find((dir) => fs.existsSync(path.join(dir, "package.json")));
5347
+ if (!root) throw new Error("could not locate package.json");
5348
+ return path.join(root, "dist");
5349
+ };
5350
+ const dist_dir = resolve_dist_dir();
5297
5351
  function mkdirp(dir) {
5298
5352
  try {
5299
5353
  fs.mkdirSync(dir, { recursive: true });
@@ -5332,15 +5386,6 @@ function copy(from, to, rename = identity, kv = {}) {
5332
5386
  else fs.copyFileSync(from, to);
5333
5387
  }
5334
5388
  }
5335
- function dist(currentPath) {
5336
- const insideDistFolder = import.meta.url.includes("dist");
5337
- return path.resolve(import.meta.dirname, insideDistFolder ? "" : "dist", currentPath);
5338
- }
5339
- function getSharedFiles() {
5340
- const shared = dist("shared.json");
5341
- const { files } = JSON.parse(fs.readFileSync(shared, "utf-8"));
5342
- return files;
5343
- }
5344
5389
  //#endregion
5345
5390
  //#region src/create/index.ts
5346
5391
  const publicTemplateTypes = [
@@ -5349,22 +5394,10 @@ const publicTemplateTypes = [
5349
5394
  "library",
5350
5395
  "addon"
5351
5396
  ];
5352
- const templateTypes = [
5353
- "minimal",
5354
- "demo",
5355
- "library",
5356
- "addon",
5357
- "svelte"
5358
- ];
5359
- const languageTypes = [
5360
- "typescript",
5361
- "checkjs",
5362
- "none"
5363
- ];
5364
5397
  function create({ cwd, ...options }) {
5365
5398
  mkdirp(cwd);
5366
5399
  write_template_files(options.template, options.types, options.name, cwd);
5367
- if (options.template !== "svelte") write_common_files(cwd, options, options.name);
5400
+ if (options.template !== "svelte") finalize_package_json(cwd, options.name);
5368
5401
  if (options.template === "addon") for (const name of [
5369
5402
  "svelte.config.js",
5370
5403
  "svelte.config.ts",
@@ -5373,7 +5406,7 @@ function create({ cwd, ...options }) {
5373
5406
  ]) fs.rmSync(path.join(cwd, name), { force: true });
5374
5407
  }
5375
5408
  const templates = publicTemplateTypes.map((dir) => {
5376
- const meta_file = dist(`templates/${dir}/meta.json`);
5409
+ const meta_file = path.join(dist_dir, "templates", dir, "meta.json");
5377
5410
  const { title, description } = JSON.parse(fs.readFileSync(meta_file, "utf8"));
5378
5411
  return {
5379
5412
  name: dir,
@@ -5382,7 +5415,7 @@ const templates = publicTemplateTypes.map((dir) => {
5382
5415
  };
5383
5416
  });
5384
5417
  function write_template_files(template, types, name, cwd) {
5385
- const dir = dist(`templates/${template}`);
5418
+ const dir = path.join(dist_dir, "templates", template);
5386
5419
  copy(`${dir}/assets`, cwd, (name) => name.replace("DOT-", "."), kv(name));
5387
5420
  copy(`${dir}/package.json`, `${cwd}/package.json`, void 0, kv(name));
5388
5421
  const manifest = `${dir}/files.types=${types}.json`;
@@ -5392,41 +5425,14 @@ function write_template_files(template, types, name, cwd) {
5392
5425
  fs.writeFileSync(dest, replace(file.contents, kv(name)));
5393
5426
  });
5394
5427
  }
5395
- function write_common_files(cwd, options, name) {
5396
- const files = getSharedFiles();
5428
+ function finalize_package_json(cwd, name) {
5397
5429
  const pkg_file = path.join(cwd, filePaths.packageJson);
5398
5430
  const pkg = JSON.parse(fs.readFileSync(pkg_file, "utf-8"));
5399
- sort_files(files).forEach((file) => {
5400
- const include = file.include.every((condition) => matches_condition(condition, options));
5401
- if (file.exclude.some((condition) => matches_condition(condition, options)) || !include) return;
5402
- if (file.name === filePaths.packageJson) {
5403
- const new_pkg = JSON.parse(file.contents);
5404
- merge(pkg, new_pkg);
5405
- } else {
5406
- const dest = path.join(cwd, file.name);
5407
- mkdirp(path.dirname(dest));
5408
- fs.writeFileSync(dest, replace(file.contents, kv(name)));
5409
- }
5410
- });
5411
5431
  pkg.dependencies = sort_keys(pkg.dependencies);
5412
5432
  pkg.devDependencies = sort_keys(pkg.devDependencies);
5413
5433
  pkg.name = sanitizeName(name, "package");
5414
5434
  fs.writeFileSync(pkg_file, JSON.stringify(pkg, null, " ") + "\n");
5415
5435
  }
5416
- function matches_condition(condition, options) {
5417
- if (templateTypes.includes(condition)) return options.template === condition;
5418
- if (languageTypes.includes(condition)) return options.types === condition;
5419
- return Boolean(options[condition]);
5420
- }
5421
- function merge(target, source) {
5422
- for (const key in source) if (key in target) {
5423
- const target_value = target[key];
5424
- const source_value = source[key];
5425
- if (typeof source_value !== typeof target_value || Array.isArray(source_value) !== Array.isArray(target_value)) throw new Error("Mismatched values");
5426
- if (typeof source_value === "object") merge(target_value, source_value);
5427
- else target[key] = source_value;
5428
- } else target[key] = source[key];
5429
- }
5430
5436
  function sort_keys(obj) {
5431
5437
  if (!obj) return;
5432
5438
  return Object.keys(obj).sort().reduce((sorted, key) => {
@@ -5434,19 +5440,8 @@ function sort_keys(obj) {
5434
5440
  return sorted;
5435
5441
  }, {});
5436
5442
  }
5437
- /**
5438
- * Sort files so that those which apply more generically come first so they
5439
- * can be overwritten by files for more precise cases later.
5440
- */
5441
- function sort_files(files) {
5442
- return files.sort((f1, f2) => {
5443
- const f1_more_generic = f1.include.every((include) => f2.include.includes(include)) && f1.exclude.every((exclude) => f2.exclude.includes(exclude));
5444
- const f2_more_generic = f2.include.every((include) => f1.include.includes(include)) && f2.exclude.every((exclude) => f1.exclude.includes(exclude));
5445
- return f1_more_generic && f2_more_generic || !f1_more_generic && !f2_more_generic ? 0 : f1_more_generic ? -1 : 1;
5446
- });
5447
- }
5448
5443
  //#endregion
5449
- //#region ../../node_modules/.pnpm/tinyexec@1.3.0/node_modules/tinyexec/dist/main.mjs
5444
+ //#region ../../node_modules/.pnpm/tinyexec@1.3.1/node_modules/tinyexec/dist/main.mjs
5450
5445
  const isPathLikePattern = /^path$/i;
5451
5446
  const defaultEnvPathInfo = {
5452
5447
  key: "PATH",
@@ -5467,7 +5462,7 @@ function getPathFromEnv(env) {
5467
5462
  function addNodeBinToPath(cwd, path) {
5468
5463
  const parts = path.value.split(delimiter);
5469
5464
  const nodeBinPaths = [];
5470
- let currentPath = cwd;
5465
+ let currentPath = typeof cwd === "string" ? cwd : fileURLToPath(cwd, { windows: false });
5471
5466
  let lastPath;
5472
5467
  do {
5473
5468
  nodeBinPaths.push(resolve(currentPath, "node_modules", ".bin"));
@@ -5593,7 +5588,8 @@ function resolveCommand$1(command, options) {
5593
5588
  let pathExt = env.PATHEXT ? env.PATHEXT.split(delimiter) : defaultPathExt;
5594
5589
  if (command.includes(".") && pathExt[0] !== "") pathExt = ["", ...pathExt];
5595
5590
  for (const extensions of [pathExt, noPathExt]) for (const path of pathEnv) {
5596
- const dest = resolve(cwd$3, path.startsWith("\"") && path.endsWith("\"") && path.length > 1 ? path.slice(1, -1) : path, command);
5591
+ const unquoted = path.startsWith("\"") && path.endsWith("\"") && path.length > 1 ? path.slice(1, -1) : path;
5592
+ const dest = resolve(cwd$3, unquoted, command);
5597
5593
  for (const ext of extensions) {
5598
5594
  const destWithExt = dest + ext;
5599
5595
  try {
@@ -5737,12 +5733,12 @@ var ExecProcess = class {
5737
5733
  _streamOut;
5738
5734
  _streamErr;
5739
5735
  spawn() {
5740
- const cwd$1 = cwd();
5741
5736
  const options = this._options;
5742
5737
  const nodeOptions = {
5743
5738
  ...defaultNodeOptions,
5744
5739
  ...options.nodeOptions
5745
5740
  };
5741
+ const cwd$1 = nodeOptions?.cwd ?? cwd();
5746
5742
  const signals = [];
5747
5743
  this._resetState();
5748
5744
  if (options.timeout !== void 0) signals.push(AbortSignal.timeout(options.timeout));
@@ -5786,11 +5782,11 @@ function xSync(command, args, options) {
5786
5782
  ...defaultSyncOptions,
5787
5783
  ...options
5788
5784
  };
5789
- const cwd$2 = cwd();
5790
5785
  const nodeOptions = {
5791
- windowsHide: true,
5786
+ ...defaultNodeOptions,
5792
5787
  ...opts.nodeOptions
5793
5788
  };
5789
+ const cwd$2 = nodeOptions?.cwd ?? cwd();
5794
5790
  if (opts.timeout !== void 0) nodeOptions.timeout = opts.timeout;
5795
5791
  nodeOptions.env = computeEnv(cwd$2, nodeOptions.env, opts.nodePath);
5796
5792
  const crossResult = normalizeSpawnCommand(command, args ?? [], nodeOptions);
@@ -5918,47 +5914,6 @@ function createOptionBuilder(options) {
5918
5914
  //#region src/core/env.ts
5919
5915
  const TESTING = V.env.NODE_ENV?.toLowerCase() === "test";
5920
5916
  //#endregion
5921
- //#region ../../node_modules/.pnpm/empathic@2.0.1/node_modules/empathic/resolve.mjs
5922
- /**
5923
- * Resolve an absolute path from {@link root}, but only
5924
- * if {@link input} isn't already absolute.
5925
- *
5926
- * @param input The path to resolve.
5927
- * @param root The base path; default = process.cwd()
5928
- * @returns The resolved absolute path.
5929
- */
5930
- function absolute(input, root) {
5931
- return isAbsolute(input) ? input : resolve(root || ".", input);
5932
- }
5933
- function from(root, ident, silent) {
5934
- try {
5935
- let r = root instanceof URL || root.startsWith("file://") ? join(fileURLToPath(root), "noop.js") : join(absolute(root), "noop.js");
5936
- return createRequire(r).resolve(ident);
5937
- } catch (err) {
5938
- if (!silent) throw err;
5939
- }
5940
- }
5941
- //#endregion
5942
- //#region ../../node_modules/.pnpm/empathic@2.0.1/node_modules/empathic/walk.mjs
5943
- /**
5944
- * Get all parent directories of {@link base}.
5945
- * Stops after {@link Options['last']} is processed.
5946
- *
5947
- * @returns An array of absolute paths of all parent directories.
5948
- */
5949
- function up$1(base, options) {
5950
- let { last, cwd } = options || {};
5951
- let tmp = absolute(base, cwd);
5952
- let root = absolute(last || "/", cwd);
5953
- let prev, arr = [];
5954
- while (prev !== root) {
5955
- arr.push(tmp);
5956
- tmp = dirname(prev = tmp);
5957
- if (tmp === prev) break;
5958
- }
5959
- return arr;
5960
- }
5961
- //#endregion
5962
5917
  //#region ../../node_modules/.pnpm/empathic@2.0.1/node_modules/empathic/find.mjs
5963
5918
  /**
5964
5919
  * Find an item by name, walking parent directories until found.
@@ -6076,13 +6031,20 @@ function isInstalled(agent) {
6076
6031
  function addAllowBuildsIfPnpm(options) {
6077
6032
  const { cwd, packageManager, packages } = options;
6078
6033
  if (packageManager !== "pnpm") return;
6079
- const found = up("pnpm-workspace.yaml", { cwd });
6080
- const filePath = found ?? path.join(cwd, "pnpm-workspace.yaml");
6081
- const content = found ? fs.readFileSync(found, "utf-8") : "";
6082
- const newContent = pnpm.allowBuilds({
6034
+ transformFile(up("pnpm-workspace.yaml", { cwd }) ?? path.join(cwd, "pnpm-workspace.yaml"), pnpm.allowBuilds({
6083
6035
  cwd,
6084
6036
  packages
6085
- })(content);
6037
+ }));
6038
+ }
6039
+ /** pnpm >= 10.5 reads its settings from `pnpm-workspace.yaml`, others from `.npmrc`. */
6040
+ function addEngineStrict(options) {
6041
+ if (options.packageManager === "pnpm" && pnpm.supportsWorkspaceSettings(options.cwd)) transformFile(path.join(options.cwd, "pnpm-workspace.yaml"), transforms.yaml(({ data }) => data.set("engineStrict", true)));
6042
+ else transformFile(path.join(options.cwd, ".npmrc"), transforms.text(({ content, text }) => text.upsert(content, "engine-strict", { value: "true" })));
6043
+ }
6044
+ /** Missing file is treated as empty, so the transform can create it. */
6045
+ function transformFile(filePath, transform) {
6046
+ const content = fs.existsSync(filePath) ? fs.readFileSync(filePath, "utf-8") : "";
6047
+ const newContent = transform(content);
6086
6048
  if (newContent && newContent !== content) fs.writeFileSync(filePath, newContent, "utf-8");
6087
6049
  }
6088
6050
  //#endregion
@@ -6473,4 +6435,4 @@ function orderAddons(addons, setupResults) {
6473
6435
  return ordered;
6474
6436
  }
6475
6437
  //#endregion
6476
- export { parse$1 as $, cliOptions as A, runAndValidateVerifications as B, execSync as C, __toESM as Ct, getSharedFiles as D, dist as E, getPadding as F, UnsupportedError as G, updateAgent as H, helpConfig as I, array as J, name as K, isNodeError as L, filePaths as M, forwardExitCode as N, PackageJSONSchema as O, getHelpSections as P, optional as Q, normalizePosix as R, exec as S, __require as St, templates as T, updateLibraryBuild as U, runCommand as V, updateReadme as W, literal as X, boolean as Y, nonEmpty as Z, createLoadedAddon as _, pe as _t, setupAddons as a, string as at, getErrorHint as b, R$1 as bt, AGENT_NAMES as c, program as ct, installDependencies as d, Ce as dt, picklist as et, installOption as f, Ee as ft, from as g, le as gt, up$1 as h, ge as ht, prepareSvApi as i, strictObject as it, errorAndExit as j, buildAndLogArgs as k, addAllowBuildsIfPnpm as l, Command as lt, up as m, Re as mt, applyAddons as n, record as nt, createWorkspace as o, transform as ot, packageManagerPrompt as p, R as pt, version as q, orderAddons as r, safeParse as rt, findWorkspaceRoot as s, union as st, add as t, pipe as tt, detectPackageManager as u, Option as ut, defineAddon as v, vt, create as w, NonZeroExitError as x, __commonJSMin as xt, defineAddonOptions as y, we as yt, parseAddonOptions as z };
6438
+ export { parse$1 as $, cliOptions as A, runAndValidateVerifications as B, create as C, __toESM as Ct, from as D, up$1 as E, getPadding as F, UnsupportedError as G, updateAgent as H, helpConfig as I, array as J, name as K, isNodeError as L, filePaths as M, forwardExitCode as N, PackageJSONSchema as O, getHelpSections as P, optional as Q, normalizePosix as R, execSync as S, __require as St, dist_dir as T, updateLibraryBuild as U, runCommand as V, updateReadme as W, literal as X, boolean as Y, nonEmpty as Z, defineAddon as _, pe as _t, setupAddons as a, string as at, NonZeroExitError as b, R$1 as bt, AGENT_NAMES as c, program as ct, detectPackageManager as d, Ce as dt, picklist as et, installDependencies as f, Ee as ft, createLoadedAddon as g, le as gt, up as h, ge as ht, prepareSvApi as i, strictObject as it, errorAndExit as j, buildAndLogArgs as k, addAllowBuildsIfPnpm as l, Command as lt, packageManagerPrompt as m, Re as mt, applyAddons as n, record as nt, createWorkspace as o, transform as ot, installOption as p, R as pt, version as q, orderAddons as r, safeParse as rt, findWorkspaceRoot as s, union as st, add as t, pipe as tt, addEngineStrict as u, Option as ut, defineAddonOptions as v, vt, templates as w, exec as x, __commonJSMin as xt, getErrorHint as y, we as yt, parseAddonOptions as z };
@@ -94,8 +94,9 @@ type Workspace = {
94
94
  language: "ts" | "js";
95
95
  file: {
96
96
  viteConfig: "vite.config.js" | "vite.config.ts";
97
- typeConfig: "jsconfig.json" | "tsconfig.json" | undefined;
98
- /** `${directory.routes}/layout.css` or `src/app.css` */
97
+ /** @type {string} absolute path */
98
+ typeConfig: `${string}jsconfig.json` | `${string}tsconfig.json` | undefined;
99
+ /** `${directory.kitRoutes}/layout.css` or `src/app.css` */
99
100
  stylesheet: `${string}/layout.css` | "src/app.css";
100
101
  package: "package.json";
101
102
  gitignore: ".gitignore";
@@ -0,0 +1,218 @@
1
+ <script lang="ts">
2
+ import favicon from '#lib/assets/favicon.svg';
3
+
4
+ let { children } = $props();
5
+
6
+ const title = '$sv-title-$sv';
7
+ const href = '$sv-url-$sv';
8
+
9
+ let prefersDark = $state(true);
10
+ let isDark = $state(true);
11
+
12
+ function switchTheme() {
13
+ const value = isDark ? 'light' : 'dark';
14
+
15
+ isDark = value === 'dark';
16
+ localStorage.setItem('sv:theme', isDark === prefersDark ? 'system' : value);
17
+ }
18
+
19
+ $effect(() => {
20
+ document.documentElement.classList.remove('light', 'dark');
21
+ prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
22
+
23
+ const theme = localStorage.getItem('sv:theme');
24
+
25
+ isDark = !theme ? prefersDark : theme === 'dark' || (theme === 'system' && prefersDark);
26
+ document.documentElement.classList.add(isDark ? 'dark' : 'light');
27
+ });
28
+ </script>
29
+
30
+ <svelte:head>
31
+ <title>--from-playground {title}</title>
32
+ <script>
33
+ {
34
+ const theme = localStorage.getItem('sv:theme');
35
+
36
+ document.documentElement.classList.add(
37
+ !theme || theme === 'system'
38
+ ? window.matchMedia('(prefers-color-scheme: dark)').matches
39
+ ? 'dark'
40
+ : 'light'
41
+ : theme
42
+ );
43
+ }
44
+ </script>
45
+ </svelte:head>
46
+
47
+ <div class="layout">
48
+ <nav class="navbar">
49
+ <div class="nav-left">
50
+ <a href="/" class="svelte-icon">
51
+ <img src={favicon} alt="Svelte" width="32" height="32" />
52
+ </a>
53
+ <p class="title">{title}</p>
54
+ </div>
55
+ <div class="nav-right">
56
+ <a {href} class="raised" target="_blank" rel="noopener noreferrer">
57
+ --to-playground
58
+ <span aria-hidden="true" style="margin-left:0.25em;"> ↗</span>
59
+ </a>
60
+ <button class="raised theme-toggle" onclick={switchTheme} aria-label="Toggle theme">
61
+ <span class="icon"></span>
62
+ </button>
63
+ </div>
64
+ </nav>
65
+
66
+ <main class="content">
67
+ {@render children()}
68
+ </main>
69
+ </div>
70
+
71
+ <style>
72
+ :global(body) {
73
+ margin: 0;
74
+ }
75
+
76
+ :global(html) {
77
+ margin: 0;
78
+ --bg-1: hsl(0, 0%, 100%);
79
+ --bg-2: hsl(206, 20%, 90%);
80
+ --bg-3: hsl(206, 20%, 80%);
81
+ --navbar-bg: #fff;
82
+ --fg-1: hsl(0, 0%, 13%);
83
+ --fg-2: hsl(0, 0%, 50%);
84
+ --fg-3: hsl(0, 0%, 60%);
85
+ --link: hsl(208, 77%, 47%);
86
+ --border-radius: 4px;
87
+ --font:
88
+ -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
89
+ 'Helvetica Neue', sans-serif;
90
+ color-scheme: light;
91
+ background: var(--bg-1);
92
+ color: var(--fg-1);
93
+ font-family: var(--font);
94
+ line-height: 1.5;
95
+ height: calc(100vh - 2rem);
96
+ accent-color: var(--link) !important;
97
+ min-height: 100vh;
98
+ background-color: var(--bg-1);
99
+ }
100
+
101
+ :global(html.dark) {
102
+ color-scheme: dark;
103
+ --bg-1: hsl(0, 0%, 18%);
104
+ --bg-2: hsl(0, 0%, 30%);
105
+ --bg-3: hsl(0, 0%, 40%);
106
+ --navbar-bg: hsl(220, 14%, 16%);
107
+ --fg-1: hsl(0, 0%, 75%);
108
+ --fg-2: hsl(0, 0%, 40%);
109
+ --fg-3: hsl(0, 0%, 30%);
110
+ --link: hsl(206, 96%, 72%);
111
+ }
112
+
113
+ .navbar {
114
+ color: var(--fg-1);
115
+ display: flex;
116
+ justify-content: space-between;
117
+ align-items: center;
118
+ padding: 0em 2.5rem;
119
+ height: 3.7rem;
120
+ background-color: var(--navbar-bg);
121
+ box-shadow:
122
+ 0 2px 8px 0 rgba(0, 0, 0, 0.08),
123
+ 0 1.5px 4px 0 rgba(0, 0, 0, 0.04);
124
+ }
125
+
126
+ .nav-left {
127
+ display: flex;
128
+ align-items: center;
129
+ gap: 0.5rem;
130
+ }
131
+
132
+ .svelte-icon {
133
+ display: flex;
134
+ align-items: center;
135
+ text-decoration: none;
136
+ transition: opacity 0.2s ease;
137
+ }
138
+
139
+ .svelte-icon:hover {
140
+ opacity: 0.8;
141
+ }
142
+
143
+ .title {
144
+ font-size: 1.5rem;
145
+ font-weight: 400;
146
+ margin: 0;
147
+ }
148
+
149
+ .nav-right {
150
+ display: flex;
151
+ align-items: center;
152
+ gap: 1rem;
153
+ }
154
+
155
+ .raised {
156
+ background: var(--navbar-bg);
157
+ border-left: 0.5px solid var(--fg-3);
158
+ border-top: 0.5px solid var(--fg-3);
159
+ border-bottom: none;
160
+ border-right: none;
161
+ border-radius: var(--border-radius);
162
+ color: var(--fg-1);
163
+ cursor: pointer;
164
+ transition: all 0.2s ease;
165
+ box-shadow:
166
+ 0 2px 4px rgba(0, 0, 0, 0.1),
167
+ 0 1px 2px rgba(0, 0, 0, 0.06);
168
+ text-decoration: none;
169
+ font-weight: 500;
170
+ padding: 0.25rem 0.75rem;
171
+ font-size: 0.8rem;
172
+ }
173
+
174
+ .raised:hover {
175
+ border-left-color: var(--fg-2);
176
+ border-top-color: var(--fg-2);
177
+ box-shadow:
178
+ 0 4px 8px rgba(0, 0, 0, 0.15),
179
+ 0 2px 4px rgba(0, 0, 0, 0.1);
180
+ transform: translate(-1px, -1px);
181
+ }
182
+
183
+ .content {
184
+ padding: 1rem;
185
+ color: var(--fg-1);
186
+ }
187
+
188
+ .theme-toggle {
189
+ display: flex;
190
+ align-items: center;
191
+ justify-content: center;
192
+ width: 1.8rem;
193
+ height: 1.8rem;
194
+ padding: 0;
195
+ min-width: 2rem;
196
+ }
197
+
198
+ .icon {
199
+ display: inline-block;
200
+ width: 1.5rem;
201
+ height: 1.5rem;
202
+ -webkit-mask-size: 1.5rem;
203
+ mask-size: 1.5rem;
204
+ -webkit-mask-repeat: no-repeat;
205
+ mask-repeat: no-repeat;
206
+ -webkit-mask-position: center;
207
+ mask-position: center;
208
+ background-color: var(--fg-1);
209
+ }
210
+
211
+ .icon {
212
+ mask-image: url('data:image/svg+xml,%3csvg%20xmlns="http://www.w3.org/2000/svg"%20viewBox="0%200%2024%2024"%3e%3cpath%20fill="%23666"%20d="M12%2021q-3.775%200-6.388-2.613T3%2012q0-3.45%202.25-5.988T11%203.05q.625-.075.975.45t-.025%201.1q-.425.65-.638%201.375T11.1%207.5q0%202.25%201.575%203.825T16.5%2012.9q.775%200%201.538-.225t1.362-.625q.525-.35%201.075-.037t.475.987q-.35%203.45-2.937%205.725T12%2021Zm0-2q2.2%200%203.95-1.213t2.55-3.162q-.5.125-1%20.2t-1%20.075q-3.075%200-5.238-2.163T9.1%207.5q0-.5.075-1t.2-1q-1.95.8-3.163%202.55T5%2012q0%202.9%202.05%204.95T12%2019Zm-.25-6.75Z"/%3e%3c/svg%3e');
213
+ }
214
+
215
+ :global(html.dark) .icon {
216
+ mask-image: url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='%23d4d4d4'%20d='M12%2019a1%201%200%200%201%20.993.883L13%2020v1a1%201%200%200%201-1.993.117L11%2021v-1a1%201%200%200%201%201-1zm6.313-2.09.094.083.7.7a1%201%200%200%201-1.32%201.497l-.094-.083-.7-.7a1%201%200%200%201%201.218-1.567l.102.07zm-11.306.083a1%201%200%200%201%20.083%201.32l-.083.094-.7.7a1%201%200%200%201-1.497-1.32l.083-.094.7-.7a1%201%200%200%201%201.414%200zM4%2011a1%201%200%200%201%20.117%201.993L4%2013H3a1%201%200%200%201-.117-1.993L3%2011h1zm17%200a1%201%200%200%201%20.117%201.993L21%2013h-1a1%201%200%200%201-.117-1.993L20%2011h1zM6.213%204.81l.094.083.7.7a1%201%200%200%201-1.32%201.497l-.094-.083-.7-.7A1%201%200%200%201%206.11%204.74l.102.07zm12.894.083a1%201%200%200%201%20.083%201.32l-.083.094-.7.7a1%201%200%200%201-1.497-1.32l.083-.094.7-.7a1%201%200%200%201%201.414%200zM12%202a1%201%200%200%201%20.993.883L13%203v1a1%201%200%200%201-1.993.117L11%204V3a1%201%200%200%201%201-1zm0%205a5%205%200%201%201-4.995%205.217L7%2012l.005-.217A5%205%200%200%201%2012%207z'/%3e%3c/svg%3e");
217
+ }
218
+ </style>
@@ -1,9 +1,8 @@
1
- import { A as SelectQuestion, C as BaseQuestion, D as OptionDefinition, E as NumberQuestion, M as ADDON_IDS, O as OptionValues, S as AddonOptions, T as MultiSelectQuestion, _ as SvApi, a as Addon, b as Workspace, c as AddonReference, d as ConditionDefinition, f as ConfiguredAddon, g as SetupResult, h as PreparedAddon, i as add, j as StringQuestion, k as Question, l as AddonResult, m as OptionBuilder, n as InstallOptions, o as AddonDefinition, p as LoadedAddon, r as OptionMap, s as AddonInput, t as AddonMap, u as AddonSource, v as defineAddon, w as BooleanQuestion, x as WorkspaceOptions, y as defineAddonOptions } from "../engine-BLZdMrao.mjs";
1
+ import { A as SelectQuestion, C as BaseQuestion, D as OptionDefinition, E as NumberQuestion, M as ADDON_IDS, O as OptionValues, S as AddonOptions, T as MultiSelectQuestion, _ as SvApi, a as Addon, b as Workspace, c as AddonReference, d as ConditionDefinition, f as ConfiguredAddon, g as SetupResult, h as PreparedAddon, i as add, j as StringQuestion, k as Question, l as AddonResult, m as OptionBuilder, n as InstallOptions, o as AddonDefinition, p as LoadedAddon, r as OptionMap, s as AddonInput, t as AddonMap, u as AddonSource, v as defineAddon, w as BooleanQuestion, x as WorkspaceOptions, y as defineAddonOptions } from "../engine-fNvU_-IL.mjs";
2
2
  //#region src/create/index.d.ts
3
- type TemplateType = (typeof templateTypes)[number];
4
- type LanguageType = (typeof languageTypes)[number];
5
- declare const templateTypes: readonly ["minimal", "demo", "library", "addon", "svelte"];
6
- declare const languageTypes: readonly ["typescript", "checkjs", "none"];
3
+ declare const publicTemplateTypes: readonly ["minimal", "demo", "library", "addon"];
4
+ type TemplateType = (typeof publicTemplateTypes)[number] | "svelte";
5
+ type LanguageType = "typescript" | "checkjs" | "none";
7
6
  type Options = {
8
7
  cwd: string;
9
8
  name: string;
@@ -18,6 +17,7 @@ type AiToolsOptions = {
18
17
  delivery: "plugin" | "tools";
19
18
  tools: string[];
20
19
  mcpSetup: "local" | "remote";
20
+ optInSkills: string[];
21
21
  };
22
22
  //#endregion
23
23
  //#region src/addons/better-auth.d.ts
@@ -52,8 +52,38 @@ type PlaywrightOptions = {
52
52
  };
53
53
  //#endregion
54
54
  //#region src/addons/sveltekit-adapter.d.ts
55
+ declare const adapters: readonly [{
56
+ readonly id: "auto";
57
+ readonly package: "@sveltejs/adapter-auto";
58
+ readonly version: "^8.0.0";
59
+ }, {
60
+ readonly id: "node";
61
+ readonly package: "@sveltejs/adapter-node";
62
+ readonly version: "^6.0.0";
63
+ }, {
64
+ readonly id: "bun";
65
+ readonly package: "@sveltejs/adapter-bun";
66
+ readonly version: "^1.0.0";
67
+ }, {
68
+ readonly id: "static";
69
+ readonly package: "@sveltejs/adapter-static";
70
+ readonly version: "^4.0.0";
71
+ }, {
72
+ readonly id: "vercel";
73
+ readonly package: "@sveltejs/adapter-vercel";
74
+ readonly version: "^7.0.0";
75
+ }, {
76
+ readonly id: "cloudflare";
77
+ readonly package: "@sveltejs/adapter-cloudflare";
78
+ readonly version: "^8.0.0";
79
+ }, {
80
+ readonly id: "netlify";
81
+ readonly package: "@sveltejs/adapter-netlify";
82
+ readonly version: "^7.0.0";
83
+ }];
84
+ type AdapterId = (typeof adapters)[number]["id"];
55
85
  type SveltekitAdapterOptions = {
56
- adapter: "auto" | "node" | "static" | "vercel" | "cloudflare" | "netlify";
86
+ adapter: AdapterId;
57
87
  cfTarget: "workers" | "pages";
58
88
  };
59
89
  //#endregion
@@ -1,3 +1,3 @@
1
- import { t as add, v as defineAddon, w as create, y as defineAddonOptions } from "../engine-CpcTzL2R.mjs";
2
- import { n as officialAddons } from "../addons-DaktRhvH.mjs";
1
+ import { C as create, _ as defineAddon, t as add, v as defineAddonOptions } from "../engine-S8UpCG24.mjs";
2
+ import { n as officialAddons } from "../addons-BCioxI2r.mjs";
3
3
  export { add, create, defineAddon, defineAddonOptions, officialAddons };
@@ -1,4 +1,4 @@
1
- import { r as OptionMap, t as AddonMap } from "../engine-BLZdMrao.mjs";
1
+ import { r as OptionMap, t as AddonMap } from "../engine-fNvU_-IL.mjs";
2
2
  import { Page } from "@playwright/test";
3
3
  import { TestProject } from "vitest/node";
4
4
  //#region src/testing.d.ts
@@ -1,4 +1,4 @@
1
- import { C as execSync, Ct as __toESM, S as exec, St as __require, l as addAllowBuildsIfPnpm, t as add, w as create, xt as __commonJSMin } from "../engine-CpcTzL2R.mjs";
1
+ import { C as create, Ct as __toESM, S as execSync, St as __require, l as addAllowBuildsIfPnpm, t as add, x as exec, xt as __commonJSMin } from "../engine-S8UpCG24.mjs";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import V from "node:process";