@shwfed/config 1.1.2 → 1.1.4

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/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "shwfed",
3
3
  "configKey": "shwfed",
4
- "version": "1.1.2",
4
+ "version": "1.1.4",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "unknown"
package/dist/module.mjs CHANGED
@@ -157,6 +157,9 @@ const module$1 = defineNuxtModule({
157
157
  }
158
158
  }
159
159
  addImports([
160
+ // Type-only auto-import: hosts binding `<ShwfedConfig v-model:config>`
161
+ // get `PageConfigValue` globally without reaching into `runtime/`.
162
+ { name: "PageConfigValue", from: resolver.resolve("./runtime/components/config/schema"), type: true },
160
163
  { name: "provideCELContext", from: resolver.resolve("./runtime/plugins/cel/context") },
161
164
  { name: "openModal", from: resolver.resolve("./runtime/composables/useOverlay") },
162
165
  { name: "confirm", from: resolver.resolve("./runtime/composables/useOverlay") },
@@ -3,7 +3,7 @@ import { Effect } from "effect";
3
3
  import { toast } from "vue-sonner";
4
4
  import { defineRegistry } from "../../../share/define-registry.js";
5
5
  const schemaModules = import.meta.glob(
6
- "../buttons/*/*/schema.ts",
6
+ "../buttons/*/*/schema.{ts,js}",
7
7
  { eager: true, exhaustive: true }
8
8
  );
9
9
  const configModuleLoaders = import.meta.glob(
@@ -1,11 +1,11 @@
1
1
  import type { Environment } from '../../vendor/cel-js/lib/index.js';
2
- import type { PageConfigValue } from './schema.js';
2
+ import { type PageConfigValue } from './schema.js';
3
3
  type __VLS_Props = {
4
4
  configure?: (env: Environment) => void;
5
5
  editable?: boolean;
6
6
  };
7
7
  type __VLS_ModelProps = {
8
- 'config': PageConfigValue;
8
+ 'config'?: PageConfigValue | null | undefined;
9
9
  };
10
10
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
11
11
  declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
@@ -19,7 +19,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
19
19
  layout: import("../form/schema.js").LayoutValue;
20
20
  }>[];
21
21
  }>;
22
- }>) => any;
22
+ }> | null | undefined) => any;
23
23
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
24
24
  "onUpdate:config"?: ((value: Readonly<{
25
25
  kind: "shwfed.component.page";
@@ -31,7 +31,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
31
31
  layout: import("../form/schema.js").LayoutValue;
32
32
  }>[];
33
33
  }>;
34
- }>) => any) | undefined;
34
+ }> | null | undefined) => any) | undefined;
35
35
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
36
36
  declare const _default: typeof __VLS_export;
37
37
  export default _default;
@@ -1,15 +1,22 @@
1
1
  <script setup>
2
- import { ref, watch } from "vue";
2
+ import { computed, ref, watch } from "vue";
3
3
  import { injectCELContext } from "../../plugins/cel/context";
4
4
  import SlotRenderer from "../../share/slot-renderer.vue";
5
5
  import ShwfedModal from "../modal.vue";
6
6
  import EditorBody from "./config.vue";
7
7
  import EditorBreadcrumb from "./breadcrumb.vue";
8
8
  import EditorFooter from "./footer.vue";
9
+ import { createPageConfig } from "./schema";
9
10
  import { useConfigEditor } from "./use-editor";
10
11
  import { findBlock } from "./utils/resolve";
11
12
  defineOptions({ name: "ShwfedConfig" });
12
- const config = defineModel("config", { type: Object, ...{ required: true } });
13
+ const configModel = defineModel("config", { type: null });
14
+ const config = computed({
15
+ get: () => configModel.value ?? createPageConfig(),
16
+ set: (next) => {
17
+ configModel.value = next;
18
+ }
19
+ });
13
20
  const props = defineProps({
14
21
  configure: { type: Function, required: false },
15
22
  editable: { type: Boolean, required: false }
@@ -1,11 +1,11 @@
1
1
  import type { Environment } from '../../vendor/cel-js/lib/index.js';
2
- import type { PageConfigValue } from './schema.js';
2
+ import { type PageConfigValue } from './schema.js';
3
3
  type __VLS_Props = {
4
4
  configure?: (env: Environment) => void;
5
5
  editable?: boolean;
6
6
  };
7
7
  type __VLS_ModelProps = {
8
- 'config': PageConfigValue;
8
+ 'config'?: PageConfigValue | null | undefined;
9
9
  };
10
10
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
11
11
  declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
@@ -19,7 +19,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
19
19
  layout: import("../form/schema.js").LayoutValue;
20
20
  }>[];
21
21
  }>;
22
- }>) => any;
22
+ }> | null | undefined) => any;
23
23
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
24
24
  "onUpdate:config"?: ((value: Readonly<{
25
25
  kind: "shwfed.component.page";
@@ -31,7 +31,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
31
31
  layout: import("../form/schema.js").LayoutValue;
32
32
  }>[];
33
33
  }>;
34
- }>) => any) | undefined;
34
+ }> | null | undefined) => any) | undefined;
35
35
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
36
36
  declare const _default: typeof __VLS_export;
37
37
  export default _default;
@@ -2,7 +2,7 @@ import { Schema } from "effect";
2
2
  import { defineRegistry } from "../../../share/define-registry.js";
3
3
  import { registerBlockRef, registerFindBlock } from "./block-ref-cache.js";
4
4
  const schemaModules = import.meta.glob(
5
- "../blocks/*/*/schema.ts",
5
+ "../blocks/*/*/schema.{ts,js}",
6
6
  { eager: true, exhaustive: true }
7
7
  );
8
8
  const configModules = import.meta.glob(
@@ -56,7 +56,7 @@ const placedFields = computed(() => {
56
56
  const gridStyle = computed(() => {
57
57
  const l = activeLayout.value?.layout;
58
58
  if (!l) return "";
59
- const colTemplate = `repeat(${l.columns}, minmax(auto, 1fr))`;
59
+ const colTemplate = `repeat(${l.columns}, minmax(0, 1fr))`;
60
60
  let rowTemplate = "";
61
61
  if (l.rows) {
62
62
  const grows = Array.from({ length: l.rows }, () => false);
@@ -67,7 +67,7 @@ const gridStyle = computed(() => {
67
67
  const hi = Math.min(l.rows, y2 - 1);
68
68
  for (let r = lo; r <= hi; r++) grows[r - 1] = true;
69
69
  }
70
- rowTemplate = grows.map((g) => g ? "auto" : "minmax(auto, 1fr)").join(" ");
70
+ rowTemplate = grows.map((g) => g ? "auto" : "minmax(0, 1fr)").join(" ");
71
71
  }
72
72
  const parts = [
73
73
  "display: grid",
@@ -80,7 +80,7 @@ const gridStyle = computed(() => {
80
80
  });
81
81
  function cellStyle(placement) {
82
82
  const [[x1, y1], [x2, y2]] = placement.area;
83
- const parts = [`grid-column: ${x1} / ${x2}`, `grid-row: ${y1} / ${y2}`];
83
+ const parts = [`grid-column: ${x1} / ${x2}`, `grid-row: ${y1} / ${y2}`, "min-width: 0"];
84
84
  const h = placement.h && placement.h !== "stretch" ? placement.h : null;
85
85
  const v = placement.v && placement.v !== "stretch" ? placement.v : null;
86
86
  if (h || v) {
@@ -88,7 +88,7 @@ function isHidden(f) {
88
88
  }
89
89
  function cellStyle(placement) {
90
90
  const [[x1, y1], [x2, y2]] = placement.area;
91
- const parts = [`grid-column: ${x1} / ${x2}`, `grid-row: ${y1} / ${y2}`];
91
+ const parts = [`grid-column: ${x1} / ${x2}`, `grid-row: ${y1} / ${y2}`, "min-width: 0"];
92
92
  const h = placement.h && placement.h !== "stretch" ? placement.h : null;
93
93
  const v = placement.v && placement.v !== "stretch" ? placement.v : null;
94
94
  if (h || v) {
@@ -123,7 +123,7 @@ const placedFields = computed(() => {
123
123
  const gridStyle = computed(() => {
124
124
  const l = activeLayout.value?.layout;
125
125
  if (!l) return "";
126
- const colTemplate = `repeat(${l.columns}, minmax(auto, 1fr))`;
126
+ const colTemplate = `repeat(${l.columns}, minmax(0, 1fr))`;
127
127
  let rowTemplate = "";
128
128
  if (l.rows) {
129
129
  const grows = Array.from({ length: l.rows }, () => false);
@@ -134,7 +134,7 @@ const gridStyle = computed(() => {
134
134
  const hi = Math.min(l.rows, y2 - 1);
135
135
  for (let r = lo; r <= hi; r++) grows[r - 1] = true;
136
136
  }
137
- rowTemplate = grows.map((g) => g ? "auto" : "minmax(auto, 1fr)").join(" ");
137
+ rowTemplate = grows.map((g) => g ? "auto" : "minmax(0, 1fr)").join(" ");
138
138
  }
139
139
  const parts = [
140
140
  "display: grid",
@@ -30,7 +30,7 @@ export type FieldSizeRange = Readonly<{
30
30
  * When true, this axis escapes the grid's `1fr` equal-share and follows
31
31
  * content instead. Currently honored only on `h` by the form runtime: any
32
32
  * row track containing at least one visible field whose `h.grow` is true is
33
- * rendered as `auto`, while other rows keep `minmax(auto, 1fr)`.
33
+ * rendered as `auto`, while other rows keep `minmax(0, 1fr)`.
34
34
  */
35
35
  grow?: boolean;
36
36
  }>;
@@ -1,6 +1,6 @@
1
1
  import { defineRegistry } from "../../../share/define-registry.js";
2
2
  const schemaModules = import.meta.glob(
3
- "../fields/*/*/schema.ts",
3
+ "../fields/*/*/schema.{ts,js}",
4
4
  { eager: true, exhaustive: true }
5
5
  );
6
6
  const configModules = import.meta.glob(
@@ -1,6 +1,6 @@
1
1
  import { defineRegistry } from "../../../share/define-registry.js";
2
2
  const schemaModules = import.meta.glob(
3
- "../columns/*/*/schema.ts",
3
+ "../columns/*/*/schema.{ts,js}",
4
4
  { eager: true, exhaustive: true }
5
5
  );
6
6
  const configModules = import.meta.glob(
@@ -8,7 +8,7 @@ export function defineRegistry(options) {
8
8
  validateModule,
9
9
  deriveEntryExtras
10
10
  } = options;
11
- const pathRe = new RegExp(`/${dirSegment}/([^/]+)/([^/]+)/schema\\.ts$`);
11
+ const pathRe = new RegExp(`/${dirSegment}/([^/]+)/([^/]+)/schema\\.(?:ts|js)$`);
12
12
  const parsePath = (path) => {
13
13
  const match = pathRe.exec(path);
14
14
  if (!match) throw new Error(`[${hostName}] unrecognized schema path: ${path}`);
@@ -29,11 +29,11 @@ export const Placement = Schema.Struct({
29
29
  export const Layout = Schema.Struct({
30
30
  columns: TrackCount.annotations({
31
31
  title: "\u5217\u6570",
32
- description: "\u603B\u5217\u6570\u3002\u6BCF\u5217\u7B49\u5BBD\uFF0C\u6E32\u67D3\u65F6\u5C55\u5F00\u4E3A `repeat(N, minmax(auto, 1fr))`"
32
+ description: "\u603B\u5217\u6570\u3002\u6BCF\u5217\u7B49\u5BBD\uFF0C\u6E32\u67D3\u65F6\u5C55\u5F00\u4E3A `repeat(N, minmax(0, 1fr))` \u2014 \u5217\u4F1A\u6536\u7F29\u4EE5\u9002\u914D\u5BB9\u5668\u5BBD\u5EA6"
33
33
  }),
34
34
  rows: Schema.optional(TrackCount.annotations({
35
35
  title: "\u884C\u6570",
36
- description: "\u603B\u884C\u6570\u3002\u6BCF\u884C\u7B49\u6743\uFF0C\u6E32\u67D3\u65F6\u5C55\u5F00\u4E3A `repeat(N, minmax(auto, 1fr))` \u2014 \u5728\u81EA\u7136\u9AD8\u5EA6\u5BB9\u5668\u5185\u7B49\u540C\u4E8E `auto`"
36
+ description: "\u603B\u884C\u6570\u3002\u6BCF\u884C\u7B49\u6743\uFF0C\u6E32\u67D3\u65F6\u5C55\u5F00\u4E3A `repeat(N, minmax(0, 1fr))` \u2014 \u5728\u81EA\u7136\u9AD8\u5EA6\u5BB9\u5668\u5185\u7B49\u540C\u4E8E `auto`"
37
37
  })),
38
38
  gap: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.positive()).annotations({
39
39
  title: "\u7F51\u683C\u95F4\u8DDD",
@@ -35,7 +35,7 @@ watch(() => props.slotValue.layouts, (sets) => {
35
35
  const gridStyle = computed(() => {
36
36
  const l = activeLayout.value?.layout;
37
37
  if (!l) return "";
38
- const tracks = (n) => `repeat(${n}, minmax(auto, 1fr))`;
38
+ const tracks = (n) => `repeat(${n}, minmax(0, 1fr))`;
39
39
  const parts = [
40
40
  "display: grid",
41
41
  `grid-template-columns: ${tracks(l.columns)}`,
@@ -47,7 +47,7 @@ const gridStyle = computed(() => {
47
47
  });
48
48
  function cellStyle(placement) {
49
49
  const [[x1, y1], [x2, y2]] = placement.area;
50
- const parts = [`grid-column: ${x1} / ${x2}`, `grid-row: ${y1} / ${y2}`];
50
+ const parts = [`grid-column: ${x1} / ${x2}`, `grid-row: ${y1} / ${y2}`, "min-width: 0"];
51
51
  const h = placement.h && placement.h !== "stretch" ? placement.h : null;
52
52
  const v = placement.v && placement.v !== "stretch" ? placement.v : null;
53
53
  if (h || v) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shwfed/config",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Configurable UI for SHWFED",
5
5
  "type": "module",
6
6
  "publishConfig": {