foldkit 0.1.0-canary.5

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 (41) hide show
  1. package/README.md +96 -0
  2. package/dist/core/fieldValidation.d.ts +62 -0
  3. package/dist/core/fieldValidation.d.ts.map +1 -0
  4. package/dist/core/fieldValidation.js +51 -0
  5. package/dist/core/fold.d.ts +12 -0
  6. package/dist/core/fold.d.ts.map +1 -0
  7. package/dist/core/fold.js +9 -0
  8. package/dist/core/html.d.ts +176 -0
  9. package/dist/core/html.d.ts.map +1 -0
  10. package/dist/core/html.js +117 -0
  11. package/dist/core/navigation.d.ts +7 -0
  12. package/dist/core/navigation.d.ts.map +1 -0
  13. package/dist/core/navigation.js +12 -0
  14. package/dist/core/parser.d.ts +133 -0
  15. package/dist/core/parser.d.ts.map +1 -0
  16. package/dist/core/parser.js +177 -0
  17. package/dist/core/route.d.ts +2 -0
  18. package/dist/core/route.d.ts.map +1 -0
  19. package/dist/core/route.js +1 -0
  20. package/dist/core/runtime/addNavigationEventListeners.d.ts +4 -0
  21. package/dist/core/runtime/addNavigationEventListeners.d.ts.map +1 -0
  22. package/dist/core/runtime/addNavigationEventListeners.js +59 -0
  23. package/dist/core/runtime/index.d.ts +2 -0
  24. package/dist/core/runtime/index.d.ts.map +1 -0
  25. package/dist/core/runtime/index.js +1 -0
  26. package/dist/core/runtime/runtime.d.ts +58 -0
  27. package/dist/core/runtime/runtime.d.ts.map +1 -0
  28. package/dist/core/runtime/runtime.js +82 -0
  29. package/dist/core/schema.d.ts +38 -0
  30. package/dist/core/schema.d.ts.map +1 -0
  31. package/dist/core/schema.js +16 -0
  32. package/dist/core/urlRequest.d.ts +30 -0
  33. package/dist/core/urlRequest.d.ts.map +1 -0
  34. package/dist/core/urlRequest.js +13 -0
  35. package/dist/core/vdom.d.ts +5 -0
  36. package/dist/core/vdom.d.ts.map +1 -0
  37. package/dist/core/vdom.js +26 -0
  38. package/dist/index.d.ts +9 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.js +8 -0
  41. package/package.json +82 -0
@@ -0,0 +1,30 @@
1
+ import { Schema as S } from 'effect';
2
+ export declare const Url: S.Struct<{
3
+ pathname: typeof S.String;
4
+ search: typeof S.String;
5
+ hash: typeof S.String;
6
+ }>;
7
+ export type Url = S.Schema.Type<typeof Url>;
8
+ export declare const Internal: S.TaggedStruct<"Internal", {
9
+ url: S.Struct<{
10
+ pathname: typeof S.String;
11
+ search: typeof S.String;
12
+ hash: typeof S.String;
13
+ }>;
14
+ }>;
15
+ export type Internal = S.Schema.Type<typeof Internal>;
16
+ export declare const External: S.TaggedStruct<"External", {
17
+ href: typeof S.String;
18
+ }>;
19
+ export type External = S.Schema.Type<typeof External>;
20
+ export declare const UrlRequest: S.Union<[S.TaggedStruct<"Internal", {
21
+ url: S.Struct<{
22
+ pathname: typeof S.String;
23
+ search: typeof S.String;
24
+ hash: typeof S.String;
25
+ }>;
26
+ }>, S.TaggedStruct<"External", {
27
+ href: typeof S.String;
28
+ }>]>;
29
+ export type UrlRequest = S.Schema.Type<typeof UrlRequest>;
30
+ //# sourceMappingURL=urlRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"urlRequest.d.ts","sourceRoot":"","sources":["../../src/core/urlRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAEpC,eAAO,MAAM,GAAG;;;;EAId,CAAA;AACF,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,GAAG,CAAC,CAAA;AAE3C,eAAO,MAAM,QAAQ;;;;;;EAEnB,CAAA;AACF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,QAAQ,CAAC,CAAA;AAErD,eAAO,MAAM,QAAQ;;EAEnB,CAAA;AACF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,QAAQ,CAAC,CAAA;AAErD,eAAO,MAAM,UAAU;;;;;;;;IAA8B,CAAA;AACrD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { Schema as S } from 'effect';
2
+ export const Url = S.Struct({
3
+ pathname: S.String,
4
+ search: S.String,
5
+ hash: S.String,
6
+ });
7
+ export const Internal = S.TaggedStruct('Internal', {
8
+ url: Url,
9
+ });
10
+ export const External = S.TaggedStruct('External', {
11
+ href: S.String,
12
+ });
13
+ export const UrlRequest = S.Union(Internal, External);
@@ -0,0 +1,5 @@
1
+ import type { VNode } from 'snabbdom';
2
+ export type { VNode } from 'snabbdom';
3
+ export declare const patch: (oldVnode: VNode | Element | DocumentFragment, vnode: VNode) => VNode;
4
+ export declare const htmlElementToVNode: (element: HTMLElement) => VNode;
5
+ //# sourceMappingURL=vdom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vdom.d.ts","sourceRoot":"","sources":["../../src/core/vdom.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAErC,YAAY,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAErC,eAAO,MAAM,KAAK,uEAAsE,CAAA;AAExF,eAAO,MAAM,kBAAkB,GAAI,SAAS,WAAW,KAAG,KA4BzD,CAAA"}
@@ -0,0 +1,26 @@
1
+ import { classModule, eventListenersModule, h, init, propsModule, styleModule } from 'snabbdom';
2
+ export const patch = init([classModule, propsModule, styleModule, eventListenersModule]);
3
+ export const htmlElementToVNode = (element) => {
4
+ const tagName = element.tagName.toLowerCase();
5
+ const data = {};
6
+ if (element.className) {
7
+ data.class = element.className;
8
+ }
9
+ if (element.id) {
10
+ data.props = { id: element.id };
11
+ }
12
+ const children = [];
13
+ for (const child of element.childNodes) {
14
+ if (child.nodeType === Node.TEXT_NODE) {
15
+ const text = child.textContent;
16
+ if (text && text.trim()) {
17
+ children.push(text);
18
+ }
19
+ }
20
+ else if (child.nodeType === Node.ELEMENT_NODE) {
21
+ /* eslint-disable-next-line @typescript-eslint/consistent-type-assertions */
22
+ children.push(htmlElementToVNode(child));
23
+ }
24
+ }
25
+ return h(tagName, data, children);
26
+ };
@@ -0,0 +1,9 @@
1
+ export declare const VERSION = "0.1.0-canary.2";
2
+ export * as Runtime from './core/runtime';
3
+ export * as Html from './core/html';
4
+ export * as Fold from './core/fold';
5
+ export * as FormValidation from './core/fieldValidation';
6
+ export * as Route from './core/route';
7
+ export * as Navigation from './core/navigation';
8
+ export * as Schema from './core/schema';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,mBAAmB,CAAA;AAEvC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;AACnC,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;AACnC,OAAO,KAAK,cAAc,MAAM,wBAAwB,CAAA;AACxD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ export const VERSION = '0.1.0-canary.2';
2
+ export * as Runtime from './core/runtime';
3
+ export * as Html from './core/html';
4
+ export * as Fold from './core/fold';
5
+ export * as FormValidation from './core/fieldValidation';
6
+ export * as Route from './core/route';
7
+ export * as Navigation from './core/navigation';
8
+ export * as Schema from './core/schema';
package/package.json ADDED
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "foldkit",
3
+ "version": "0.1.0-canary.5",
4
+ "description": "Elm-inspired UI framework powered by Effect",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ },
14
+ "./html": {
15
+ "types": "./dist/core/html.d.ts",
16
+ "import": "./dist/core/html.js"
17
+ },
18
+ "./navigation": {
19
+ "types": "./dist/core/navigation.d.ts",
20
+ "import": "./dist/core/navigation.js"
21
+ },
22
+ "./route": {
23
+ "types": "./dist/core/route.d.ts",
24
+ "import": "./dist/core/route.js"
25
+ },
26
+ "./runtime": {
27
+ "types": "./dist/core/runtime/index.d.ts",
28
+ "import": "./dist/core/runtime/index.js"
29
+ },
30
+ "./fold": {
31
+ "types": "./dist/core/fold.d.ts",
32
+ "import": "./dist/core/fold.js"
33
+ },
34
+ "./formValidation": {
35
+ "types": "./dist/core/fieldValidation.d.ts",
36
+ "import": "./dist/core/fieldValidation.js"
37
+ },
38
+ "./schema": {
39
+ "types": "./dist/core/schema.d.ts",
40
+ "import": "./dist/core/schema.js"
41
+ }
42
+ },
43
+ "files": [
44
+ "dist"
45
+ ],
46
+ "scripts": {
47
+ "clean": "rimraf dist *.tsbuildinfo",
48
+ "build": "pnpm run clean && tsc -b",
49
+ "watch": "tsc -b --watch",
50
+ "typecheck": "tsc -b --noEmit"
51
+ },
52
+ "peerDependencies": {
53
+ "effect": "^3.16.8"
54
+ },
55
+ "devDependencies": {
56
+ "effect": "^3.16.8",
57
+ "typescript": "^5.4.0"
58
+ },
59
+ "keywords": [
60
+ "effect",
61
+ "ui",
62
+ "elm",
63
+ "functional",
64
+ "typescript"
65
+ ],
66
+ "author": "Devin Jameson",
67
+ "license": "MIT",
68
+ "repository": {
69
+ "type": "git",
70
+ "url": "https://github.com/devinjameson/foldkit.git",
71
+ "directory": "packages/foldkit"
72
+ },
73
+ "dependencies": {
74
+ "snabbdom": "^3.6.2"
75
+ },
76
+ "publishConfig": {
77
+ "access": "public"
78
+ },
79
+ "engines": {
80
+ "node": ">=18.0.0"
81
+ }
82
+ }