@small-web/kitten-types 1.0.1 → 1.1.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.
package/README.md CHANGED
@@ -4,8 +4,6 @@ Type-safety for [Kitten](https://kitten.small-web.org) apps and sites.
4
4
 
5
5
  This is a **types-only** package. It declares the global `kitten` namespace (via `declare global`) and exports reusable Kitten types you can use to annotate your own code.
6
6
 
7
- > 💡 The older [`@small-web/kitten`](https://www.npmjs.com/package/@small-web/kitten) module [has now been deprecated](#relationship-to-small-web-kitten). You should use this module for new projects and plan on migrating existing projects over to it going forward.
8
-
9
7
  ## Install
10
8
 
11
9
  ```shell
@@ -116,7 +114,9 @@ If you want type safety for your custom project database, please create and use
116
114
 
117
115
  ## Relationship to `@small-web/kitten`
118
116
 
119
- The older [`@small-web/kitten`](https://www.npmjs.com/package/@small-web/kitten) globals module cast the members of `globalThis.kitten` at runtime and provided type safety for JavaScript projects (prior to TypeScript support being added to Kitten).
117
+ > 💡 The older [`@small-web/kitten`](https://www.npmjs.com/package/@small-web/kitten) module [has now been deprecated](#relationship-to-small-web-kitten). You should use this module for new projects and plan on migrating existing projects over to it going forward.
118
+
119
+ The older globals module cast the members of `globalThis.kitten` at runtime and provided type safety for JavaScript projects (prior to TypeScript support being added to Kitten).
120
120
 
121
121
  This was problematic as a discrepency between Kitten and the globals module was not just a missing completion in your editor but could break your app at runtime.
122
122
 
package/fragments.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ type Fragment = (props?: {SLOT?: any}) => string
2
+
3
+ declare module '*.fragment.html' {
4
+ const fragment: Fragment
5
+ export default fragment
6
+ }
7
+ declare module '*.fragment.css' {
8
+ const fragment: Fragment
9
+ export default fragment
10
+ }
11
+ declare module '*.fragment.md' {
12
+ const fragment: Fragment
13
+ export default fragment
14
+ }
package/global.d.ts CHANGED
@@ -1009,7 +1009,22 @@ export interface kitten {
1009
1009
  /**
1010
1010
  The app data directory for the current app (site/project).
1011
1011
 
1012
- Set to the return value of {@link utils.getProjectIdentifierForDomain} in {@link KITTEN_DATA_DIRECTORY}.
1012
+ Use when opening your database in a Database App Module to get the path to it.
1013
+
1014
+ @example
1015
+ JSDB.open(
1016
+ path.join(kitten.paths.APP_DATA_DIRECTORY, 'db'),
1017
+ {
1018
+ compactOnLoad,
1019
+ classes: [
1020
+ Database,
1021
+ Kitten
1022
+ ]
1023
+ }
1024
+ )
1025
+
1026
+ @see https://kitten.small-web.org/tutorials/database-app-modules/
1027
+ @see https://codeberg.org/kitten/app/src/branch/main/examples/database-app-module/app_modules/database/database.js#L46
1013
1028
  */
1014
1029
  APP_DATA_DIRECTORY: string
1015
1030
 
package/index.d.ts CHANGED
@@ -7,6 +7,7 @@
7
7
  */
8
8
 
9
9
  import './global.d.ts'
10
+ import './fragments.d.ts'
10
11
 
11
12
  // Reusable types, re-exported for explicit annotations
12
13
  // (e.g. `import type { KittenRequest } from '@small-web/kitten-types'`).
@@ -33,7 +34,7 @@ export type {
33
34
  Signature
34
35
  } from './types.d.ts'
35
36
 
36
- export { yaml } from './types.d.ts'
37
+ export type { yaml } from './types.d.ts'
37
38
 
38
39
  // Also export hand-written global namespace shape, in case an author wants to reference it explicitly (e.g. `typeof kitten`).
39
40
  export type { kitten } from './global.d.ts'
package/package.json CHANGED
@@ -1,13 +1,23 @@
1
1
  {
2
2
  "name": "@small-web/kitten-types",
3
- "version": "1.0.1",
3
+ "version": "1.1.1",
4
4
  "description": "Types-only package for Kitten: declares global `kitten` namespace and exports Kitten types.",
5
5
  "types": "index.d.ts",
6
+ "files": [
7
+ "index.d.ts",
8
+ "global.d.ts",
9
+ "fragments.d.ts",
10
+ "types.d.ts",
11
+ "polka/index.d.ts",
12
+ "slugify/index.d.ts",
13
+ "ws/index.d.ts"
14
+ ],
6
15
  "exports": {
7
16
  ".": {
8
17
  "types": "./index.d.ts"
9
18
  },
10
19
  "./global.d.ts": "./global.d.ts",
20
+ "./fragments.d.ts": "./fragments.d.ts",
11
21
  "./types.d.ts": "./types.d.ts"
12
22
  },
13
23
  "type": "module",
package/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import EventEmitter from 'node:events'
2
+ import type polka from 'polka'
2
3
 
3
4
  /**
4
5
  Represents a browser session.
@@ -39,7 +40,7 @@ export class Session extends EventEmitter {
39
40
 
40
41
  export type { default as WebSocket, BufferLike } from './ws/index.d.ts'
41
42
  export type { default as slugify } from './slugify/index.d.ts'
42
- export type { default as Polka } from './polka/index.d.ts'
43
+ export type Polka = ReturnType<typeof polka>
43
44
  export { default as MarkdownIt } from 'markdown-it'
44
45
 
45
46
  export namespace yaml {
package/CHANGELOG.md DELETED
@@ -1,20 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
-
7
- ## [1.0.1] - 2026-06-26
8
-
9
- ### Added
10
-
11
- - Missing types
12
- - Documentation for all types
13
-
14
- ## [1.0.0] - 2026-06-23
15
-
16
- __Initial release__
17
-
18
- The predecessor of this module is Kitten Globals ([@small-web/kitten](https://codeberg.org/kitten/globals)), which has now been deprecated.
19
-
20
- For previous history, please see that module.