dev-annotate 0.2.0 → 0.2.1

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.
@@ -13,11 +13,11 @@ var DEFAULTS = {
13
13
 
14
14
  // src/core/client.ts
15
15
  function initDevAnnotation(options = {}) {
16
- const endpoint = options.endpoint ?? DEFAULTS.endpoint;
17
- const colors = options.colors ?? DEFAULTS.colors;
18
- const sizePresets = options.sizes ?? DEFAULTS.sizes;
19
- const shortcutKey = (options.shortcutKey ?? DEFAULTS.shortcutKey).toLowerCase();
20
- const z = options.zIndexBase ?? DEFAULTS.zIndexBase;
16
+ const endpoint = typeof options.endpoint === "string" && options.endpoint ? options.endpoint : DEFAULTS.endpoint;
17
+ const colors = Array.isArray(options.colors) && options.colors.length ? options.colors : DEFAULTS.colors;
18
+ const sizePresets = Array.isArray(options.sizes) && options.sizes.length ? options.sizes : DEFAULTS.sizes;
19
+ const shortcutKey = (typeof options.shortcutKey === "string" && options.shortcutKey ? options.shortcutKey : DEFAULTS.shortcutKey).toLowerCase();
20
+ const z = typeof options.zIndexBase === "number" ? options.zIndexBase : DEFAULTS.zIndexBase;
21
21
  const nodes = [];
22
22
  const cleanups = [];
23
23
  const track = (n) => {
@@ -6,15 +6,15 @@ var module_default = defineNuxtModule({
6
6
  setup(options, nuxt) {
7
7
  if (!nuxt.options.dev) return;
8
8
  const resolver = createResolver(import.meta.url);
9
+ const publicConfig = {};
10
+ if (options.endpoint !== void 0) publicConfig.endpoint = options.endpoint;
11
+ if (options.colors !== void 0) publicConfig.colors = options.colors;
12
+ if (options.sizes !== void 0) publicConfig.sizes = options.sizes;
13
+ if (options.shortcutKey !== void 0) publicConfig.shortcutKey = options.shortcutKey;
14
+ if (options.zIndexBase !== void 0) publicConfig.zIndexBase = options.zIndexBase;
9
15
  nuxt.options.runtimeConfig.public = nuxt.options.runtimeConfig.public ?? {};
10
- nuxt.options.runtimeConfig.public.devAnnotate = {
11
- endpoint: options.endpoint,
12
- colors: options.colors,
13
- sizes: options.sizes,
14
- shortcutKey: options.shortcutKey,
15
- zIndexBase: options.zIndexBase
16
- };
17
- nuxt.options.runtimeConfig.devAnnotate = { dir: options.dir };
16
+ nuxt.options.runtimeConfig.public.devAnnotate = publicConfig;
17
+ nuxt.options.runtimeConfig.devAnnotate = options.dir !== void 0 ? { dir: options.dir } : {};
18
18
  addPlugin({ src: resolver.resolve("./runtime/plugin.client.js"), mode: "client" });
19
19
  addServerHandler({
20
20
  route: options.endpoint ?? "/api/dev/save-annotation",
@@ -16,11 +16,11 @@ var DEFAULTS = {
16
16
 
17
17
  // src/core/client.ts
18
18
  function initDevAnnotation(options = {}) {
19
- const endpoint = options.endpoint ?? DEFAULTS.endpoint;
20
- const colors = options.colors ?? DEFAULTS.colors;
21
- const sizePresets = options.sizes ?? DEFAULTS.sizes;
22
- const shortcutKey = (options.shortcutKey ?? DEFAULTS.shortcutKey).toLowerCase();
23
- const z = options.zIndexBase ?? DEFAULTS.zIndexBase;
19
+ const endpoint = typeof options.endpoint === "string" && options.endpoint ? options.endpoint : DEFAULTS.endpoint;
20
+ const colors = Array.isArray(options.colors) && options.colors.length ? options.colors : DEFAULTS.colors;
21
+ const sizePresets = Array.isArray(options.sizes) && options.sizes.length ? options.sizes : DEFAULTS.sizes;
22
+ const shortcutKey = (typeof options.shortcutKey === "string" && options.shortcutKey ? options.shortcutKey : DEFAULTS.shortcutKey).toLowerCase();
23
+ const z = typeof options.zIndexBase === "number" ? options.zIndexBase : DEFAULTS.zIndexBase;
24
24
  const nodes = [];
25
25
  const cleanups = [];
26
26
  const track = (n) => {
package/package.json CHANGED
@@ -1,36 +1,36 @@
1
- {
2
- "name": "dev-annotate",
3
- "version": "0.2.0",
4
- "description": "Dev-only on-screen annotation tool: scribble on the live page, take an OS screenshot, upload it for an AI agent to read.",
5
- "type": "module",
6
- "license": "MIT",
7
- "keywords": ["annotation", "screenshot", "dev-tool", "design-review", "ai", "nuxt"],
8
- "engines": { "node": ">=20" },
9
- "bin": { "dev-annotate": "dist/cli.js" },
10
- "exports": {
11
- ".": { "import": "./dist/core/client.js", "types": "./dist/core/client.d.ts" },
12
- "./server": { "import": "./dist/server/index.js", "types": "./dist/server/index.d.ts" },
13
- "./nuxt": { "import": "./dist/nuxt/module.js", "types": "./dist/nuxt/module.d.ts" }
14
- },
15
- "files": ["dist", "templates", "README.md", "LICENSE"],
16
- "scripts": {
17
- "build": "tsup",
18
- "typecheck": "tsc --noEmit",
19
- "test": "vitest run",
20
- "prepublishOnly": "tsup"
21
- },
22
- "peerDependencies": { "h3": "*", "@nuxt/kit": "*" },
23
- "peerDependenciesMeta": {
24
- "h3": { "optional": true },
25
- "@nuxt/kit": { "optional": true }
26
- },
27
- "devDependencies": {
28
- "@types/node": "^22.10.2",
29
- "tsup": "^8.5.1",
30
- "typescript": "^5.7.3",
31
- "vitest": "^3.2.4",
32
- "jsdom": "^25.0.0",
33
- "h3": "^1.13.0",
34
- "@nuxt/kit": "^3.14.0"
35
- }
36
- }
1
+ {
2
+ "name": "dev-annotate",
3
+ "version": "0.2.1",
4
+ "description": "Dev-only on-screen annotation tool: scribble on the live page, take an OS screenshot, upload it for an AI agent to read.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "keywords": ["annotation", "screenshot", "dev-tool", "design-review", "ai", "nuxt"],
8
+ "engines": { "node": ">=20" },
9
+ "bin": { "dev-annotate": "dist/cli.js" },
10
+ "exports": {
11
+ ".": { "import": "./dist/core/client.js", "types": "./dist/core/client.d.ts" },
12
+ "./server": { "import": "./dist/server/index.js", "types": "./dist/server/index.d.ts" },
13
+ "./nuxt": { "import": "./dist/nuxt/module.js", "types": "./dist/nuxt/module.d.ts" }
14
+ },
15
+ "files": ["dist", "templates", "README.md", "LICENSE"],
16
+ "scripts": {
17
+ "build": "tsup",
18
+ "typecheck": "tsc --noEmit",
19
+ "test": "vitest run",
20
+ "prepublishOnly": "tsup"
21
+ },
22
+ "peerDependencies": { "h3": "*", "@nuxt/kit": "*" },
23
+ "peerDependenciesMeta": {
24
+ "h3": { "optional": true },
25
+ "@nuxt/kit": { "optional": true }
26
+ },
27
+ "devDependencies": {
28
+ "@types/node": "^22.10.2",
29
+ "tsup": "^8.5.1",
30
+ "typescript": "^5.7.3",
31
+ "vitest": "^3.2.4",
32
+ "jsdom": "^25.0.0",
33
+ "h3": "^1.13.0",
34
+ "@nuxt/kit": "^3.14.0"
35
+ }
36
+ }