@holo-js/adapter-sveltekit 0.1.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.
- package/dist/client.d.ts +7 -0
- package/dist/client.mjs +60 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.mjs +30 -0
- package/package.json +41 -0
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { InferSchemaData } from '@holo-js/forms';
|
|
2
|
+
import { useForm as useForm$1, UseFormOptions, UseFormResult } from '@holo-js/forms/client';
|
|
3
|
+
export { ClientSubmitContext, ClientSubmitResult, FormFieldState, FormFieldTree, UseFormOptions, UseFormResult, ValidateOnMode } from '@holo-js/forms/client';
|
|
4
|
+
|
|
5
|
+
declare function useForm<TSchema extends Parameters<typeof useForm$1>[0]>(schemaDefinition: TSchema, options?: UseFormOptions<InferSchemaData<TSchema['fields']>>): UseFormResult<InferSchemaData<TSchema['fields']>>;
|
|
6
|
+
|
|
7
|
+
export { useForm };
|
package/dist/client.mjs
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// src/client.ts
|
|
2
|
+
import { createSubscriber } from "svelte/reactivity";
|
|
3
|
+
import {
|
|
4
|
+
useForm as createForm
|
|
5
|
+
} from "@holo-js/forms/client";
|
|
6
|
+
function isPlainObject(value) {
|
|
7
|
+
return !!value && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date) && !(value instanceof Blob);
|
|
8
|
+
}
|
|
9
|
+
function createReactiveView(target, subscribe, cache) {
|
|
10
|
+
const cached = cache.get(target);
|
|
11
|
+
if (cached) {
|
|
12
|
+
return cached;
|
|
13
|
+
}
|
|
14
|
+
const proxy = new Proxy({}, {
|
|
15
|
+
get(_shell, key) {
|
|
16
|
+
subscribe();
|
|
17
|
+
const value = Reflect.get(target, key);
|
|
18
|
+
if (typeof value === "function") {
|
|
19
|
+
return value.bind(target);
|
|
20
|
+
}
|
|
21
|
+
if (isPlainObject(value)) {
|
|
22
|
+
return createReactiveView(value, subscribe, cache);
|
|
23
|
+
}
|
|
24
|
+
return value;
|
|
25
|
+
},
|
|
26
|
+
set(_shell, key, value) {
|
|
27
|
+
return Reflect.set(target, key, value);
|
|
28
|
+
},
|
|
29
|
+
ownKeys() {
|
|
30
|
+
subscribe();
|
|
31
|
+
return Reflect.ownKeys(target);
|
|
32
|
+
},
|
|
33
|
+
getOwnPropertyDescriptor(_shell, key) {
|
|
34
|
+
subscribe();
|
|
35
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(target, key);
|
|
36
|
+
if (!descriptor) {
|
|
37
|
+
return void 0;
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
...descriptor,
|
|
41
|
+
configurable: true
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
has(_shell, key) {
|
|
45
|
+
subscribe();
|
|
46
|
+
return Reflect.has(target, key);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
cache.set(target, proxy);
|
|
50
|
+
return proxy;
|
|
51
|
+
}
|
|
52
|
+
function useForm(schemaDefinition, options = {}) {
|
|
53
|
+
const form = createForm(schemaDefinition, options);
|
|
54
|
+
const subscribe = createSubscriber((update) => form.subscribe(update));
|
|
55
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
56
|
+
return createReactiveView(form, subscribe, cache);
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
useForm
|
|
60
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as _holo_js_core from '@holo-js/core';
|
|
2
|
+
import { HoloFrameworkOptions, HoloAdapterProject } from '@holo-js/core';
|
|
3
|
+
import { HoloConfigMap } from '@holo-js/config';
|
|
4
|
+
|
|
5
|
+
type SvelteKitHoloOptions = HoloFrameworkOptions;
|
|
6
|
+
type SvelteKitHoloProject<TCustom extends HoloConfigMap = HoloConfigMap> = HoloAdapterProject<TCustom>;
|
|
7
|
+
declare const svelteKitHoloCapabilities: Readonly<_holo_js_core.HoloAdapterCapabilities>;
|
|
8
|
+
declare function createSvelteKitHoloProject<TCustom extends HoloConfigMap = HoloConfigMap>(options?: SvelteKitHoloOptions): Promise<SvelteKitHoloProject<TCustom>>;
|
|
9
|
+
declare function initializeSvelteKitHoloProject<TCustom extends HoloConfigMap = HoloConfigMap>(options?: SvelteKitHoloOptions): Promise<SvelteKitHoloProject<TCustom>>;
|
|
10
|
+
declare function createSvelteKitHoloHelpers<TCustom extends HoloConfigMap = HoloConfigMap>(options?: SvelteKitHoloOptions): _holo_js_core.HoloAdapterProjectAccessors<TCustom>;
|
|
11
|
+
declare function resetSvelteKitHoloProject(): Promise<void>;
|
|
12
|
+
declare const adapterSvelteKitInternals: {
|
|
13
|
+
getState: () => _holo_js_core.HoloFrameworkAdapterState<HoloAdapterProject<object>>;
|
|
14
|
+
resolveOptions: (projectOptions?: HoloFrameworkOptions | undefined) => _holo_js_core.ResolvedHoloFrameworkOptions;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { type SvelteKitHoloOptions, type SvelteKitHoloProject, adapterSvelteKitInternals, createSvelteKitHoloHelpers, createSvelteKitHoloProject, initializeSvelteKitHoloProject, resetSvelteKitHoloProject, svelteKitHoloCapabilities };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import {
|
|
3
|
+
createHoloFrameworkAdapter
|
|
4
|
+
} from "@holo-js/core";
|
|
5
|
+
var svelteKitAdapter = createHoloFrameworkAdapter({
|
|
6
|
+
stateKey: "__holoSvelteKitAdapter__",
|
|
7
|
+
displayName: "SvelteKit"
|
|
8
|
+
});
|
|
9
|
+
var svelteKitHoloCapabilities = svelteKitAdapter.capabilities;
|
|
10
|
+
async function createSvelteKitHoloProject(options = {}) {
|
|
11
|
+
return svelteKitAdapter.createProject(options);
|
|
12
|
+
}
|
|
13
|
+
async function initializeSvelteKitHoloProject(options = {}) {
|
|
14
|
+
return svelteKitAdapter.initializeProject(options);
|
|
15
|
+
}
|
|
16
|
+
function createSvelteKitHoloHelpers(options = {}) {
|
|
17
|
+
return svelteKitAdapter.createHelpers(options);
|
|
18
|
+
}
|
|
19
|
+
async function resetSvelteKitHoloProject() {
|
|
20
|
+
await svelteKitAdapter.resetProject();
|
|
21
|
+
}
|
|
22
|
+
var adapterSvelteKitInternals = svelteKitAdapter.internals;
|
|
23
|
+
export {
|
|
24
|
+
adapterSvelteKitInternals,
|
|
25
|
+
createSvelteKitHoloHelpers,
|
|
26
|
+
createSvelteKitHoloProject,
|
|
27
|
+
initializeSvelteKitHoloProject,
|
|
28
|
+
resetSvelteKitHoloProject,
|
|
29
|
+
svelteKitHoloCapabilities
|
|
30
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@holo-js/adapter-sveltekit",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Holo-JS Framework - SvelteKit adapter",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.mjs",
|
|
11
|
+
"default": "./dist/index.mjs"
|
|
12
|
+
},
|
|
13
|
+
"./client": {
|
|
14
|
+
"types": "./dist/client.d.ts",
|
|
15
|
+
"import": "./dist/client.mjs",
|
|
16
|
+
"default": "./dist/client.mjs"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"main": "./dist/index.mjs",
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsup",
|
|
26
|
+
"stub": "tsup",
|
|
27
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
28
|
+
"test": "vitest --run"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@holo-js/config": "workspace:*",
|
|
32
|
+
"@holo-js/core": "workspace:*",
|
|
33
|
+
"@holo-js/forms": "workspace:*"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/node": "catalog:",
|
|
37
|
+
"tsup": "catalog:",
|
|
38
|
+
"typescript": "catalog:",
|
|
39
|
+
"vitest": "catalog:"
|
|
40
|
+
}
|
|
41
|
+
}
|