@sjsf/skeleton-theme 2.0.0-next.6 → 2.0.0-next.8

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.
@@ -10,7 +10,9 @@
10
10
  defineDisabled(ctx, {
11
11
  disabled,
12
12
  ...config.uiOptions?.button,
13
- ...config.uiOptions?.buttons?.[type]
13
+ ...config.uiOptions?.buttons?.[type],
14
+ ...ctx.extraUiOptions?.('button', config),
15
+ ...ctx.extraUiOptions?.('buttons', config)?.[type]
14
16
  })
15
17
  );
16
18
  </script>
@@ -1,8 +1,16 @@
1
1
  <script lang="ts">
2
- import type { ComponentProps } from '@sjsf/form';
2
+ import { getFormContext, type ComponentProps } from '@sjsf/form';
3
3
  import '@sjsf/basic-theme/components/description.svelte';
4
4
 
5
5
  const { description, config }: ComponentProps['description'] = $props();
6
+
7
+ const ctx = getFormContext();
6
8
  </script>
7
9
 
8
- <div class="opacity-60" {...config.uiOptions?.descriptionAttributes}>{description}</div>
10
+ <div
11
+ class="opacity-60"
12
+ {...config.uiOptions?.descriptionAttributes}
13
+ {...ctx.extraUiOptions?.('descriptionAttributes', config)}
14
+ >
15
+ {description}
16
+ </div>
@@ -1,11 +1,18 @@
1
1
  <script lang="ts">
2
- import type { ComponentProps } from '@sjsf/form';
2
+ import { getFormContext, type ComponentProps } from '@sjsf/form';
3
3
  import '@sjsf/basic-theme/components/errors-list.svelte';
4
4
 
5
- const { errors, forId, config }: ComponentProps['errorsList'] = $props();
5
+ const { errors, config }: ComponentProps['errorsList'] = $props();
6
+
7
+ const ctx = getFormContext();
6
8
  </script>
7
9
 
8
- <ui class="text-error-500" data-errors-for={forId} {...config.uiOptions?.errorsList}>
10
+ <ui
11
+ class="text-error-500"
12
+ data-errors-for={config.id}
13
+ {...config.uiOptions?.errorsList}
14
+ {...ctx.extraUiOptions?.('errorsList', config)}
15
+ >
9
16
  {#each errors as err}
10
17
  <li>{err.message}</li>
11
18
  {/each}
@@ -1,6 +1,4 @@
1
1
  import '@sjsf/basic-theme/components/errors-list.svelte';
2
- declare const ErrorsList: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
3
- forId: string;
4
- }, {}, "">;
2
+ declare const ErrorsList: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps, {}, "">;
5
3
  type ErrorsList = ReturnType<typeof ErrorsList>;
6
4
  export default ErrorsList;
@@ -3,6 +3,7 @@ export { default as submitButton } from './submit-button.svelte';
3
3
  export { default as button } from './button.svelte';
4
4
  export { default as layout } from './layout.svelte';
5
5
  export { default as title } from './title.svelte';
6
+ export { default as label } from "./label.svelte";
6
7
  export { default as description } from './description.svelte';
7
8
  export { default as help } from './help.svelte';
8
9
  export { default as errorsList } from './errors-list.svelte';
@@ -3,6 +3,7 @@ export { default as submitButton } from './submit-button.svelte';
3
3
  export { default as button } from './button.svelte';
4
4
  export { default as layout } from './layout.svelte';
5
5
  export { default as title } from './title.svelte';
6
+ export { default as label } from "./label.svelte";
6
7
  export { default as description } from './description.svelte';
7
8
  export { default as help } from './help.svelte';
8
9
  export { default as errorsList } from './errors-list.svelte';
@@ -12,6 +12,7 @@
12
12
  use:enhance={ctx}
13
13
  class="flex flex-col gap-4"
14
14
  {...config.uiOptions?.form}
15
+ {...ctx.extraUiOptions?.('form', config)}
15
16
  {...attributes}
16
17
  >
17
18
  {@render children?.()}
@@ -1,8 +1,16 @@
1
1
  <script lang="ts">
2
- import type { ComponentProps } from '@sjsf/form';
2
+ import { getFormContext, type ComponentProps } from '@sjsf/form';
3
3
  import '@sjsf/basic-theme/components/help.svelte';
4
4
 
5
5
  const { help, config }: ComponentProps['help'] = $props();
6
+
7
+ const ctx = getFormContext();
6
8
  </script>
7
9
 
8
- <div class="opacity-60" {...config.uiOptions?.helpAttributes}>{help}</div>
10
+ <div
11
+ class="opacity-60"
12
+ {...config.uiOptions?.helpAttributes}
13
+ {...ctx.extraUiOptions?.('helpAttributes', config)}
14
+ >
15
+ {help}
16
+ </div>
@@ -0,0 +1,20 @@
1
+ <script lang="ts">
2
+ import { getFormContext, type ComponentProps } from '@sjsf/form';
3
+ import '@sjsf/basic-theme/components/label.svelte';
4
+
5
+ const { title, config }: ComponentProps['label'] = $props();
6
+
7
+ const ctx = getFormContext();
8
+ </script>
9
+
10
+ <label
11
+ class="label-text"
12
+ for={config.id}
13
+ {...config.uiOptions?.labelAttributes}
14
+ {...ctx.extraUiOptions?.('labelAttributes', config)}
15
+ >
16
+ {title}
17
+ {#if config.required}
18
+ <span>*</span>
19
+ {/if}
20
+ </label>
@@ -0,0 +1,6 @@
1
+ import '@sjsf/basic-theme/components/label.svelte';
2
+ declare const Label: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
3
+ title: string;
4
+ }, {}, "">;
5
+ type Label = ReturnType<typeof Label>;
6
+ export default Label;
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import type { ComponentProps } from '@sjsf/form';
2
+ import { getFormContext, type ComponentProps } from '@sjsf/form';
3
3
  import '@sjsf/basic-theme/components/layout.svelte';
4
4
 
5
5
  const { type, children, config }: ComponentProps['layout'] = $props();
@@ -23,9 +23,13 @@
23
23
  type === 'object-properties'
24
24
  );
25
25
 
26
+ const ctx = getFormContext();
27
+
26
28
  const attributes = $derived({
27
29
  ...config.uiOptions?.layout,
28
- ...config.uiOptions?.layouts?.[type]
30
+ ...config.uiOptions?.layouts?.[type],
31
+ ...ctx.extraUiOptions?.('layout', config),
32
+ ...ctx.extraUiOptions?.('layouts', config)?.[type]
29
33
  });
30
34
  </script>
31
35
 
@@ -6,7 +6,12 @@
6
6
 
7
7
  const ctx = getFormContext();
8
8
 
9
- const attributes = $derived(defineDisabled(ctx, config.uiOptions?.submitButton ?? {}));
9
+ const attributes = $derived(
10
+ defineDisabled(ctx, {
11
+ ...config.uiOptions?.submitButton,
12
+ ...ctx.extraUiOptions?.('submitButton', config)
13
+ })
14
+ );
10
15
  </script>
11
16
 
12
17
  <button class="btn preset-filled preset-filled-primary-500 w-full" type="submit" {...attributes}>
@@ -1,17 +1,16 @@
1
1
  <script lang="ts">
2
- import type { ComponentProps } from '@sjsf/form';
2
+ import { getFormContext, type ComponentProps } from '@sjsf/form';
3
3
  import '@sjsf/basic-theme/components/title.svelte';
4
4
 
5
- const { title, type, forId, required, config }: ComponentProps['title'] = $props();
5
+ const { title, type, config }: ComponentProps['title'] = $props();
6
+
7
+ const ctx = getFormContext();
6
8
  </script>
7
9
 
8
- {#if type === 'field'}
9
- <label class="label-text" for={forId} {...config.uiOptions?.labelAttributes}>
10
- {title}
11
- {#if required}
12
- <span>*</span>
13
- {/if}
14
- </label>
15
- {:else}
16
- <div class="font-bold text-xl" {...config.uiOptions?.titleAttributes}>{title}</div>
17
- {/if}
10
+ <div
11
+ class={type === 'field' ? 'label-text' : 'font-bold text-xl'}
12
+ {...config.uiOptions?.titleAttributes}
13
+ {...ctx.extraUiOptions?.('titleAttributes', config)}
14
+ >
15
+ {title}
16
+ </div>
@@ -2,8 +2,6 @@ import '@sjsf/basic-theme/components/title.svelte';
2
2
  declare const Title: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
3
3
  type: import("@sjsf/form/templates/components").ParentTemplateType;
4
4
  title: string;
5
- forId: string;
6
- required: boolean;
7
5
  }, {}, "">;
8
6
  type Title = ReturnType<typeof Title>;
9
7
  export default Title;
@@ -18,7 +18,15 @@
18
18
 
19
19
  const ctx = getFormContext();
20
20
 
21
- const attributes = $derived(inputAttributes(ctx, config, handlers, config.uiOptions?.checkboxes));
21
+ const attributes = $derived(
22
+ inputAttributes(
23
+ ctx,
24
+ config,
25
+ handlers,
26
+ config.uiOptions?.checkboxes,
27
+ ctx.extraUiOptions?.('checkbox', config)
28
+ )
29
+ );
22
30
  </script>
23
31
 
24
32
  {#each options as option, index (option.id)}
@@ -6,7 +6,15 @@
6
6
 
7
7
  const ctx = getFormContext();
8
8
 
9
- const attributes = $derived(inputAttributes(ctx, config, handlers, config.uiOptions?.datePicker));
9
+ const attributes = $derived(
10
+ inputAttributes(
11
+ ctx,
12
+ config,
13
+ handlers,
14
+ config.uiOptions?.datePicker,
15
+ ctx.extraUiOptions?.('datePicker', config)
16
+ )
17
+ );
10
18
  </script>
11
19
 
12
20
  <input type="date" bind:value class="input" {...attributes} />
@@ -13,7 +13,15 @@
13
13
 
14
14
  const ctx = getFormContext();
15
15
 
16
- const attributes = $derived(inputAttributes(ctx, config, handlers, config.uiOptions?.file));
16
+ const attributes = $derived(
17
+ inputAttributes(
18
+ ctx,
19
+ config,
20
+ handlers,
21
+ config.uiOptions?.file,
22
+ ctx.extraUiOptions?.('file', config)
23
+ )
24
+ );
17
25
  </script>
18
26
 
19
27
  <input
@@ -13,7 +13,13 @@
13
13
  const ctx = getFormContext();
14
14
 
15
15
  const attributes = $derived(
16
- selectAttributes(ctx, config, handlers, config.uiOptions?.multiSelect)
16
+ selectAttributes(
17
+ ctx,
18
+ config,
19
+ handlers,
20
+ config.uiOptions?.multiSelect,
21
+ ctx.extraUiOptions?.('multiSelect', config)
22
+ )
17
23
  );
18
24
 
19
25
  const mapped = $derived(
@@ -13,7 +13,15 @@
13
13
 
14
14
  const ctx = getFormContext();
15
15
 
16
- const attributes = $derived(inputAttributes(ctx, config, handlers, config.uiOptions?.radio));
16
+ const attributes = $derived(
17
+ inputAttributes(
18
+ ctx,
19
+ config,
20
+ handlers,
21
+ config.uiOptions?.radio,
22
+ ctx.extraUiOptions?.('radio', config)
23
+ )
24
+ );
17
25
  </script>
18
26
 
19
27
  {#each options as option, index (option.id)}
@@ -6,7 +6,15 @@
6
6
 
7
7
  const ctx = getFormContext();
8
8
 
9
- const attributes = $derived(inputAttributes(ctx, config, handlers, config.uiOptions?.range));
9
+ const attributes = $derived(
10
+ inputAttributes(
11
+ ctx,
12
+ config,
13
+ handlers,
14
+ config.uiOptions?.range,
15
+ ctx.extraUiOptions?.('range', config)
16
+ )
17
+ );
10
18
  </script>
11
19
 
12
20
  <input
@@ -7,7 +7,13 @@
7
7
  const ctx = getFormContext();
8
8
 
9
9
  const attributes = $derived(
10
- textareaAttributes(ctx, config, handlers, config.uiOptions?.textarea)
10
+ textareaAttributes(
11
+ ctx,
12
+ config,
13
+ handlers,
14
+ config.uiOptions?.textarea,
15
+ ctx.extraUiOptions?.('textarea', config)
16
+ )
11
17
  );
12
18
  </script>
13
19
 
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const theme: import("@sjsf/form/lib/resolver").Resolver<import("@sjsf/form/lib/resolver").Chain<Record<"stringField" | "numberField" | "integerField" | "booleanField" | "objectField" | "arrayField" | "tupleField" | "nullField" | "oneOfField" | "anyOfField" | "arrayItemField" | "objectPropertyField" | keyof import("@sjsf/form/fields/resolver/definitions").ExtraFields, any>, Record<"form" | "button" | "submitButton" | "fieldTemplate" | "objectTemplate" | "objectPropertyTemplate" | "arrayTemplate" | "arrayItemTemplate" | "multiFieldTemplate" | "layout" | "textWidget" | "numberWidget" | "selectWidget" | "checkboxWidget" | "title" | "description" | "help" | "errorsList" | keyof import("./definitions").ExtraWidgets, any>>, import("@sjsf/form/lib/resolver").Chain<typeof import("@sjsf/form/fields/exports") & Pick<import("@sjsf/form").ComponentDefinitions, keyof import("@sjsf/form/fields/resolver/definitions").ExtraFields>, typeof import("@sjsf/form/templates/exports") & typeof import("./components/exports.js") & typeof import("./widgets/exports.js") & Pick<import("@sjsf/form").ComponentDefinitions, keyof import("./definitions").ExtraWidgets>>>;
1
+ export declare const theme: import("@sjsf/form/lib/resolver").Resolver<import("@sjsf/form/lib/resolver").Chain<Record<"stringField" | "numberField" | "integerField" | "booleanField" | "objectField" | "arrayField" | "tupleField" | "nullField" | "oneOfField" | "anyOfField" | "arrayItemField" | "objectPropertyField" | keyof import("@sjsf/form/fields/resolver/definitions").ExtraFields, any>, Record<"form" | "button" | "title" | "description" | "help" | "submitButton" | "layout" | "errorsList" | "fieldTemplate" | "objectTemplate" | "objectPropertyTemplate" | "arrayTemplate" | "arrayItemTemplate" | "multiFieldTemplate" | "textWidget" | "numberWidget" | "selectWidget" | "checkboxWidget" | "label" | keyof import("./definitions").ExtraWidgets, any>>, import("@sjsf/form/lib/resolver").Chain<typeof import("@sjsf/form/fields/exports") & Pick<import("@sjsf/form").ComponentDefinitions, keyof import("@sjsf/form/fields/resolver/definitions").ExtraFields>, typeof import("@sjsf/form/templates/exports") & typeof import("./components/exports.js") & typeof import("./widgets/exports.js") & Pick<import("@sjsf/form").ComponentDefinitions, keyof import("./definitions").ExtraWidgets>>>;
package/dist/specs.d.ts CHANGED
@@ -7,3 +7,4 @@ import './extra-widgets/radio-include';
7
7
  import './extra-widgets/range-include';
8
8
  import './extra-widgets/textarea-include';
9
9
  export declare const specs: s.Specs;
10
+ export declare const extraWidgets: string[];
package/dist/specs.js CHANGED
@@ -13,3 +13,4 @@ export const specs = {
13
13
  range: [s.number, { 'ui:components': { numberWidget: 'rangeWidget' } }],
14
14
  textarea: [s.text, { 'ui:components': { textWidget: 'textareaWidget' } }]
15
15
  };
16
+ export const extraWidgets = Object.keys(import.meta.glob('./extra-widgets/*.svelte')).map((widget) => widget.substring(16, widget.length - 7));
@@ -6,7 +6,15 @@
6
6
 
7
7
  const ctx = getFormContext();
8
8
 
9
- const attributes = $derived(inputAttributes(ctx, config, handlers, config.uiOptions?.checkbox));
9
+ const attributes = $derived(
10
+ inputAttributes(
11
+ ctx,
12
+ config,
13
+ handlers,
14
+ config.uiOptions?.checkbox,
15
+ ctx.extraUiOptions?.('checkbox', config)
16
+ )
17
+ );
10
18
  </script>
11
19
 
12
20
  <label class="flex items-center space-x-2 cursor-pointer">
@@ -6,7 +6,15 @@
6
6
 
7
7
  const ctx = getFormContext();
8
8
 
9
- const attributes = $derived(inputAttributes(ctx, config, handlers, config.uiOptions?.number));
9
+ const attributes = $derived(
10
+ inputAttributes(
11
+ ctx,
12
+ config,
13
+ handlers,
14
+ config.uiOptions?.number,
15
+ ctx.extraUiOptions?.('number', config)
16
+ )
17
+ );
10
18
  </script>
11
19
 
12
20
  <input
@@ -15,7 +15,15 @@
15
15
 
16
16
  const ctx = getFormContext();
17
17
 
18
- const attributes = $derived(selectAttributes(ctx, config, handlers, config.uiOptions?.select));
18
+ const attributes = $derived(
19
+ selectAttributes(
20
+ ctx,
21
+ config,
22
+ handlers,
23
+ config.uiOptions?.select,
24
+ ctx.extraUiOptions?.('select', config)
25
+ )
26
+ );
19
27
  </script>
20
28
 
21
29
  <select class="select" bind:value={mapped.value} {...attributes}>
@@ -6,7 +6,15 @@
6
6
 
7
7
  const ctx = getFormContext();
8
8
 
9
- const attributes = $derived(inputAttributes(ctx, config, handlers, config.uiOptions?.text));
9
+ const attributes = $derived(
10
+ inputAttributes(
11
+ ctx,
12
+ config,
13
+ handlers,
14
+ config.uiOptions?.text,
15
+ ctx.extraUiOptions?.('text', config)
16
+ )
17
+ );
10
18
  </script>
11
19
 
12
20
  <input type="text" bind:value class="input" {...attributes} />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjsf/skeleton-theme",
3
- "version": "2.0.0-next.6",
3
+ "version": "2.0.0-next.8",
4
4
  "description": "The skeleton based theme for svelte-jsonschema-form",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -52,40 +52,40 @@
52
52
  }
53
53
  },
54
54
  "peerDependencies": {
55
- "@sjsf/form": "^2.0.0-next.6",
56
- "@sjsf/basic-theme": "^2.0.0-next.6",
55
+ "@sjsf/form": "^2.0.0-next.8",
56
+ "@sjsf/basic-theme": "^2.0.0-next.8",
57
57
  "@skeletonlabs/skeleton": ">=3.0.0-next.0 <=3.0.0-next.10",
58
58
  "@tailwindcss/forms": "^0.5.0",
59
59
  "svelte": "^5.25.0"
60
60
  },
61
61
  "devDependencies": {
62
- "@playwright/test": "^1.51.0",
62
+ "@playwright/test": "^1.51.1",
63
63
  "@skeletonlabs/skeleton": "3.0.0-next.10",
64
64
  "@sveltejs/adapter-static": "^3.0.8",
65
- "@sveltejs/kit": "^2.20.2",
65
+ "@sveltejs/kit": "^2.20.4",
66
66
  "@sveltejs/package": "^2.3.10",
67
67
  "@sveltejs/vite-plugin-svelte": "^5.0.3",
68
68
  "@tailwindcss/forms": "^0.5.10",
69
69
  "@types/eslint": "^9.6.1",
70
70
  "ajv": "^8.17.1",
71
71
  "autoprefixer": "^10.4.21",
72
- "eslint": "^9.23.0",
72
+ "eslint": "^9.24.0",
73
73
  "eslint-config-prettier": "^10.1.1",
74
- "eslint-plugin-svelte": "^3.3.3",
74
+ "eslint-plugin-svelte": "^3.5.1",
75
75
  "globals": "^16.0.0",
76
76
  "postcss": "^8.5.3",
77
77
  "prettier": "^3.5.3",
78
78
  "prettier-plugin-svelte": "^3.3.3",
79
- "svelte": "^5.25.3",
79
+ "svelte": "^5.25.9",
80
80
  "svelte-check": "^4.1.5",
81
81
  "tailwindcss": "^3.4.17",
82
- "typescript-eslint": "^8.27.0",
83
- "vite": "6.2.2",
84
- "vitest": "3.0.9",
85
- "@sjsf/ajv8-validator": "2.0.0-next.6",
86
- "@sjsf/basic-theme": "2.0.0-next.6",
87
- "@sjsf/form": "2.0.0-next.6",
88
- "testing": "0.1.0-next.6"
82
+ "typescript-eslint": "^8.29.1",
83
+ "vite": "6.2.5",
84
+ "vitest": "3.1.1",
85
+ "@sjsf/ajv8-validator": "2.0.0-next.8",
86
+ "@sjsf/basic-theme": "2.0.0-next.8",
87
+ "@sjsf/form": "2.0.0-next.8",
88
+ "testing": "0.1.0-next.8"
89
89
  },
90
90
  "svelte": "./dist/index.js",
91
91
  "types": "./dist/index.d.ts",