@gtkx/config 0.21.0 → 1.0.0-rc.2

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 (82) hide show
  1. package/README.md +137 -82
  2. package/dist/config-error.d.ts +16 -0
  3. package/dist/config-error.d.ts.map +1 -0
  4. package/dist/config-error.js +45 -0
  5. package/dist/config-error.js.map +1 -0
  6. package/dist/config.d.ts +73 -37
  7. package/dist/config.d.ts.map +1 -1
  8. package/dist/config.js +123 -82
  9. package/dist/config.js.map +1 -1
  10. package/dist/index.d.ts +2 -10
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +2 -8
  13. package/dist/index.js.map +1 -1
  14. package/dist/internal.d.ts +3 -0
  15. package/dist/internal.d.ts.map +1 -0
  16. package/dist/internal.js +3 -0
  17. package/dist/internal.js.map +1 -0
  18. package/dist/loader.d.ts +21 -16
  19. package/dist/loader.d.ts.map +1 -1
  20. package/dist/loader.js +26 -38
  21. package/dist/loader.js.map +1 -1
  22. package/dist/user-event-signals.d.ts +4 -0
  23. package/dist/user-event-signals.d.ts.map +1 -0
  24. package/dist/user-event-signals.js +54 -0
  25. package/dist/user-event-signals.js.map +1 -0
  26. package/dist/virtual.d.ts +9 -6
  27. package/dist/virtual.d.ts.map +1 -1
  28. package/dist/virtual.js +26 -18
  29. package/dist/virtual.js.map +1 -1
  30. package/dist/vite-plugin.d.ts +16 -0
  31. package/dist/vite-plugin.d.ts.map +1 -0
  32. package/dist/vite-plugin.js +31 -0
  33. package/dist/vite-plugin.js.map +1 -0
  34. package/package.json +18 -11
  35. package/src/config-error.ts +67 -0
  36. package/src/config.ts +227 -145
  37. package/src/index.ts +3 -83
  38. package/src/internal.ts +2 -0
  39. package/src/loader.ts +44 -55
  40. package/src/user-event-signals.ts +57 -0
  41. package/src/virtual.ts +28 -34
  42. package/src/vite-plugin.ts +51 -0
  43. package/dist/bundled-modules.d.ts +0 -2
  44. package/dist/bundled-modules.d.ts.map +0 -1
  45. package/dist/bundled-modules.js +0 -2
  46. package/dist/bundled-modules.js.map +0 -1
  47. package/dist/data-dir.d.ts +0 -4
  48. package/dist/data-dir.d.ts.map +0 -1
  49. package/dist/data-dir.js +0 -37
  50. package/dist/data-dir.js.map +0 -1
  51. package/dist/plugin.d.ts +0 -9
  52. package/dist/plugin.d.ts.map +0 -1
  53. package/dist/plugin.js +0 -24
  54. package/dist/plugin.js.map +0 -1
  55. package/dist/runtime.d.ts +0 -22
  56. package/dist/runtime.d.ts.map +0 -1
  57. package/dist/runtime.js +0 -22
  58. package/dist/runtime.js.map +0 -1
  59. package/dist/table-rules-ir.d.ts +0 -36
  60. package/dist/table-rules-ir.d.ts.map +0 -1
  61. package/dist/table-rules-ir.js +0 -2
  62. package/dist/table-rules-ir.js.map +0 -1
  63. package/dist/table-schema.d.ts +0 -107
  64. package/dist/table-schema.d.ts.map +0 -1
  65. package/dist/table-schema.js +0 -199
  66. package/dist/table-schema.js.map +0 -1
  67. package/dist/validators.d.ts +0 -4
  68. package/dist/validators.d.ts.map +0 -1
  69. package/dist/validators.js +0 -10
  70. package/dist/validators.js.map +0 -1
  71. package/dist/wrapper-protocol.d.ts +0 -12
  72. package/dist/wrapper-protocol.d.ts.map +0 -1
  73. package/dist/wrapper-protocol.js +0 -12
  74. package/dist/wrapper-protocol.js.map +0 -1
  75. package/env.d.ts +0 -26
  76. package/src/bundled-modules.ts +0 -1
  77. package/src/data-dir.ts +0 -39
  78. package/src/plugin.ts +0 -30
  79. package/src/table-rules-ir.ts +0 -42
  80. package/src/table-schema.ts +0 -342
  81. package/src/validators.ts +0 -15
  82. package/src/wrapper-protocol.ts +0 -21
@@ -0,0 +1,57 @@
1
+ const DEFAULT_USER_EVENT_SIGNALS: Record<string, string[]> = {
2
+ AdwAlertDialog: ["response"],
3
+ AdwCarousel: ["page-changed"],
4
+ AdwDialog: ["closed"],
5
+ AdwNavigationView: ["pushed"],
6
+ AdwTabView: ["close-page", "page-attached", "page-detached", "page-reordered"],
7
+ GObject: ["notify"],
8
+ GtkAdjustment: ["changed", "value-changed"],
9
+ GtkAppChooserButton: ["changed"],
10
+ GtkAppChooserWidget: ["application-selected"],
11
+ GtkCalendar: ["day-selected"],
12
+ GtkCheckButton: ["toggled"],
13
+ GtkComboBox: ["changed"],
14
+ GtkEditable: ["changed", "delete-text", "insert-text"],
15
+ GtkEntryBuffer: ["deleted-text", "inserted-text"],
16
+ GtkFlowBox: ["selected-children-changed"],
17
+ GtkIconView: ["selection-changed"],
18
+ GtkListBox: ["row-selected", "selected-rows-changed"],
19
+ GtkNotebook: ["page-added", "page-removed", "page-reordered", "switch-page"],
20
+ GtkPopover: ["closed"],
21
+ GtkRange: ["value-changed"],
22
+ GtkScaleButton: ["value-changed"],
23
+ GtkScrolledWindow: ["edge-reached"],
24
+ GtkSearchEntry: ["search-changed"],
25
+ GtkSelectionModel: ["selection-changed"],
26
+ GtkSpinButton: ["value-changed"],
27
+ GtkSwitch: ["state-set"],
28
+ GtkTextBuffer: [
29
+ "apply-tag",
30
+ "changed",
31
+ "delete-range",
32
+ "insert-child-anchor",
33
+ "insert-paintable",
34
+ "insert-text",
35
+ "mark-deleted",
36
+ "mark-set",
37
+ "modified-changed",
38
+ "remove-tag",
39
+ ],
40
+ GtkToggleButton: ["toggled"],
41
+ GtkTreeSelection: ["changed"],
42
+ GtkTreeView: ["columns-changed", "cursor-changed", "row-collapsed", "row-expanded"],
43
+ GtkWidget: ["state-flags-changed"],
44
+ };
45
+
46
+ const resolveUserEventSignals = (overrides: Record<string, string[]> | undefined): Record<string, string[]> => {
47
+ const resolved: Record<string, string[]> = { ...DEFAULT_USER_EVENT_SIGNALS };
48
+ const overrideEntries = Object.entries(overrides ?? {});
49
+
50
+ for (const [typeName, signals] of overrideEntries) {
51
+ resolved[typeName] = [...new Set([...(resolved[typeName] ?? []), ...signals])];
52
+ }
53
+
54
+ return resolved;
55
+ };
56
+
57
+ export { DEFAULT_USER_EVENT_SIGNALS, resolveUserEventSignals };
package/src/virtual.ts CHANGED
@@ -1,42 +1,36 @@
1
- import type { ResolvedGtkxConfig } from "./config.js";
2
-
3
- export const GTKX_CONFIG_VIRTUAL_ID = "virtual:gtkx-config";
4
-
5
- export const RESOLVED_GTKX_CONFIG_VIRTUAL_ID: string = `\0${GTKX_CONFIG_VIRTUAL_ID}`;
1
+ import type { ResolvedConfig } from "./config.js";
6
2
 
3
+ const GTKX_CONFIG_VIRTUAL_ID = "virtual:gtkx-config";
4
+ const RESOLVED_GTKX_CONFIG_VIRTUAL_ID = `\0${GTKX_CONFIG_VIRTUAL_ID}`;
7
5
  const METADATA_SPECIFIER = "@gtkx/jsx/metadata";
8
6
 
9
- export type SerializedGtkxConfig = Pick<
10
- ResolvedGtkxConfig,
11
- | "libraries"
12
- | "girPath"
13
- | "applicationId"
14
- | "containerProps"
15
- | "arrayProps"
16
- | "objectProps"
17
- | "virtualProps"
18
- | "elementMap"
19
- | "reactCompiler"
20
- >;
7
+ const lazyElementConfig = (lazyElements: string[]): Record<string, { lazy: true }> =>
8
+ Object.fromEntries(lazyElements.map((type) => [type, { lazy: true }]));
21
9
 
22
- const serializeConfigValue = (value: unknown): string => (value === undefined ? "undefined" : JSON.stringify(value));
10
+ /**
11
+ * The runtime element config is the app's static per-element config (currently its lazy flags) merged
12
+ * with its behaviors module, so a single `elements` map is registered.
13
+ */
14
+ const renderConfigModule = (config: ResolvedConfig): string => {
15
+ const lazyJson = JSON.stringify(lazyElementConfig(config.lazyElements));
23
16
 
24
- export const serializeGtkxConfig = (config: ResolvedGtkxConfig): SerializedGtkxConfig => ({
25
- libraries: config.libraries,
26
- girPath: config.girPath,
27
- applicationId: config.applicationId,
28
- containerProps: config.containerProps,
29
- arrayProps: config.arrayProps,
30
- objectProps: config.objectProps,
31
- virtualProps: config.virtualProps,
32
- elementMap: config.elementMap,
33
- reactCompiler: config.reactCompiler,
34
- });
17
+ const behaviorImports =
18
+ config.elements === null
19
+ ? []
20
+ : [
21
+ "import { mergeElementConfigs } from \"@gtkx/react/config\";",
22
+ `import __elementBehaviors from ${JSON.stringify(config.elements)};`,
23
+ ];
35
24
 
36
- export const renderGtkxConfigModule = (config: ResolvedGtkxConfig): string =>
37
- [
25
+ return [
26
+ ...behaviorImports,
38
27
  `export * from ${JSON.stringify(METADATA_SPECIFIER)};`,
39
- ...Object.entries(serializeGtkxConfig(config)).map(
40
- ([key, value]) => `export const ${key} = ${serializeConfigValue(value)};`,
41
- ),
28
+ `export const applicationId = ${JSON.stringify(config.applicationId)};`,
29
+ `export const userEventSignals = ${JSON.stringify(config.userEventSignals)};`,
30
+ config.elements === null
31
+ ? `export const elements = ${lazyJson};`
32
+ : `export const elements = mergeElementConfigs(__elementBehaviors, ${lazyJson});`,
42
33
  ].join("\n");
34
+ };
35
+
36
+ export { GTKX_CONFIG_VIRTUAL_ID, RESOLVED_GTKX_CONFIG_VIRTUAL_ID, renderConfigModule };
@@ -0,0 +1,51 @@
1
+ import type { Plugin, UserConfig } from "vite";
2
+ import { type ConfigLoader, createConfigLoader } from "./loader.js";
3
+ import { GTKX_CONFIG_VIRTUAL_ID, renderConfigModule, RESOLVED_GTKX_CONFIG_VIRTUAL_ID } from "./virtual.js";
4
+
5
+ type PluginState = {
6
+ root: string | undefined;
7
+ };
8
+
9
+ const resolveVirtualId = (id: string): string | null =>
10
+ id === GTKX_CONFIG_VIRTUAL_ID ? RESOLVED_GTKX_CONFIG_VIRTUAL_ID : null;
11
+
12
+ const loadVirtualModule = async (
13
+ id: string,
14
+ loadConfig: ConfigLoader,
15
+ state: PluginState,
16
+ ): Promise<string | undefined> => {
17
+ if (id !== RESOLVED_GTKX_CONFIG_VIRTUAL_ID) {
18
+ return undefined;
19
+ }
20
+
21
+ return renderConfigModule(await loadConfig(state.root ?? process.cwd()));
22
+ };
23
+
24
+ /**
25
+ * Creates the Vite plugin that resolves and serves the `virtual:gtkx-config`
26
+ * module, exposing the JSX metadata and the resolved application ID from the
27
+ * project's configuration.
28
+ * @param options Plugin name, an optional custom {@link ConfigLoader}, and an
29
+ * optional hook returning extra Vite user config.
30
+ */
31
+ const createConfigPlugin = (options: {
32
+ name: string;
33
+ loadConfig?: ConfigLoader;
34
+ config?: () => Omit<UserConfig, "plugins">;
35
+ }): Plugin => {
36
+ const loadConfig = options.loadConfig ?? createConfigLoader();
37
+ const state: PluginState = { root: undefined };
38
+
39
+ return {
40
+ name: options.name,
41
+ config(config: UserConfig) {
42
+ state.root = config.root ?? state.root;
43
+
44
+ return options.config?.();
45
+ },
46
+ resolveId: (id: string) => resolveVirtualId(id),
47
+ load: (id: string) => loadVirtualModule(id, loadConfig, state),
48
+ };
49
+ };
50
+
51
+ export default createConfigPlugin;
@@ -1,2 +0,0 @@
1
- export declare const gtkxBundledModulePatterns: RegExp[];
2
- //# sourceMappingURL=bundled-modules.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bundled-modules.d.ts","sourceRoot":"","sources":["../src/bundled-modules.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB,EAAE,MAAM,EAAyE,CAAC"}
@@ -1,2 +0,0 @@
1
- export const gtkxBundledModulePatterns = [/@gtkx\/(config|ffi|gi|react|jsx|testing|css)/, /[/\\]\.gtkx[/\\]/];
2
- //# sourceMappingURL=bundled-modules.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bundled-modules.js","sourceRoot":"","sources":["../src/bundled-modules.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,yBAAyB,GAAa,CAAC,8CAA8C,EAAE,kBAAkB,CAAC,CAAC"}
@@ -1,4 +0,0 @@
1
- export declare const DATA_IMPORT_PREFIX = "#data";
2
- export declare const DATA_IMPORT_KEY: string;
3
- export declare const resolveDataDir: (root: string) => string | null;
4
- //# sourceMappingURL=data-dir.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"data-dir.d.ts","sourceRoot":"","sources":["../src/data-dir.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,UAAU,CAAC;AAE1C,eAAO,MAAM,eAAe,EAAE,MAAkC,CAAC;AAuBjE,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,KAAG,MAAM,GAAG,IAUtD,CAAC"}
package/dist/data-dir.js DELETED
@@ -1,37 +0,0 @@
1
- import { readFileSync } from "node:fs";
2
- import { join } from "node:path";
3
- export const DATA_IMPORT_PREFIX = "#data";
4
- export const DATA_IMPORT_KEY = `${DATA_IMPORT_PREFIX}/*`;
5
- const CONDITION_PRIORITY = ["default", "import", "node"];
6
- const targetString = (entry) => {
7
- if (typeof entry === "string")
8
- return entry;
9
- if (entry !== null && typeof entry === "object" && !Array.isArray(entry)) {
10
- const conditions = entry;
11
- for (const condition of CONDITION_PRIORITY) {
12
- const value = conditions[condition];
13
- if (typeof value === "string")
14
- return value;
15
- }
16
- }
17
- return null;
18
- };
19
- const DATA_TARGET_PATTERN = /^\.?\/?(.+?)\/\*$/;
20
- const directoryFromTarget = (target) => {
21
- const match = DATA_TARGET_PATTERN.exec(target);
22
- return match?.[1] ?? null;
23
- };
24
- export const resolveDataDir = (root) => {
25
- let manifest;
26
- try {
27
- manifest = JSON.parse(readFileSync(join(root, "package.json"), "utf-8"));
28
- }
29
- catch {
30
- return null;
31
- }
32
- const target = targetString(manifest.imports?.[DATA_IMPORT_KEY]);
33
- if (target === null)
34
- return null;
35
- return directoryFromTarget(target);
36
- };
37
- //# sourceMappingURL=data-dir.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"data-dir.js","sourceRoot":"","sources":["../src/data-dir.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAE1C,MAAM,CAAC,MAAM,eAAe,GAAW,GAAG,kBAAkB,IAAI,CAAC;AAEjE,MAAM,kBAAkB,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,MAAM,C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CAAC;AACvC,CAAC,CAAC"}
package/dist/plugin.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import type { Plugin, UserConfig } from "vite";
2
- import { type GtkxConfigLoader } from "./loader.js";
3
- export interface GtkxConfigPluginOptions {
4
- name: string;
5
- loadConfig?: GtkxConfigLoader;
6
- config?: (config: UserConfig) => Omit<UserConfig, "plugins"> | null | undefined;
7
- }
8
- export declare const createGtkxConfigPlugin: (options: GtkxConfigPluginOptions) => Plugin;
9
- //# sourceMappingURL=plugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,EAA0B,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG5E,MAAM,WAAW,uBAAuB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;CACnF;AAED,eAAO,MAAM,sBAAsB,GAAI,SAAS,uBAAuB,KAAG,MAmBzE,CAAC"}
package/dist/plugin.js DELETED
@@ -1,24 +0,0 @@
1
- import { createGtkxConfigLoader } from "./loader.js";
2
- import { GTKX_CONFIG_VIRTUAL_ID, RESOLVED_GTKX_CONFIG_VIRTUAL_ID, renderGtkxConfigModule } from "./virtual.js";
3
- export const createGtkxConfigPlugin = (options) => {
4
- const loadConfig = options.loadConfig ?? createGtkxConfigLoader();
5
- let root;
6
- return {
7
- name: options.name,
8
- config(config) {
9
- root = config.root ?? root;
10
- return options.config?.(config) ?? undefined;
11
- },
12
- resolveId(id) {
13
- if (id === GTKX_CONFIG_VIRTUAL_ID)
14
- return RESOLVED_GTKX_CONFIG_VIRTUAL_ID;
15
- return undefined;
16
- },
17
- async load(id) {
18
- if (id !== RESOLVED_GTKX_CONFIG_VIRTUAL_ID)
19
- return undefined;
20
- return renderGtkxConfigModule(await loadConfig(root ?? process.cwd()));
21
- },
22
- };
23
- };
24
- //# sourceMappingURL=plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAyB,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,+BAA+B,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAQ/G,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,OAAgC,EAAU,EAAE;IAC/E,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,sBAAsB,EAAE,CAAC;IAClE,IAAI,IAAwB,CAAC;IAE7B,OAAO;QACH,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,MAAM,CAAC,MAAkB;YACrB,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC;YAC3B,OAAO,OAAO,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC;QACjD,CAAC;QACD,SAAS,CAAC,EAAU;YAChB,IAAI,EAAE,KAAK,sBAAsB;gBAAE,OAAO,+BAA+B,CAAC;YAC1E,OAAO,SAAS,CAAC;QACrB,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAU;YACjB,IAAI,EAAE,KAAK,+BAA+B;gBAAE,OAAO,SAAS,CAAC;YAC7D,OAAO,sBAAsB,CAAC,MAAM,UAAU,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAC3E,CAAC;KACJ,CAAC;AACN,CAAC,CAAC"}
package/dist/runtime.d.ts DELETED
@@ -1,22 +0,0 @@
1
- /// <reference path="../virtual.d.ts" preserve="true" />
2
- /**
3
- * Runtime window onto the project's resolved `gtkx.config.ts`: a verbatim
4
- * re-export of the `virtual:gtkx-config` module served by `gtkx dev`/
5
- * `gtkx build` and by the `@gtkx/vitest` plugin. Each resolved config field
6
- * is a named constant — frozen at build time, identical on every import —
7
- * alongside the codegen-derived metadata tables.
8
- *
9
- * @example
10
- * ```tsx
11
- * import { applicationId } from "@gtkx/config/runtime";
12
- * import { GtkApplication, GtkApplicationWindow } from "@gtkx/jsx/gtk";
13
- *
14
- * const App = () => (
15
- * <GtkApplication applicationId={applicationId}>
16
- * <GtkApplicationWindow title="Hello" defaultWidth={400} defaultHeight={300} />
17
- * </GtkApplication>
18
- * );
19
- * ```
20
- */
21
- export * from "virtual:gtkx-config";
22
- //# sourceMappingURL=runtime.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,cAAc,qBAAqB,CAAC"}
package/dist/runtime.js DELETED
@@ -1,22 +0,0 @@
1
- /// <reference path="../virtual.d.ts" preserve="true" />
2
- /**
3
- * Runtime window onto the project's resolved `gtkx.config.ts`: a verbatim
4
- * re-export of the `virtual:gtkx-config` module served by `gtkx dev`/
5
- * `gtkx build` and by the `@gtkx/vitest` plugin. Each resolved config field
6
- * is a named constant — frozen at build time, identical on every import —
7
- * alongside the codegen-derived metadata tables.
8
- *
9
- * @example
10
- * ```tsx
11
- * import { applicationId } from "@gtkx/config/runtime";
12
- * import { GtkApplication, GtkApplicationWindow } from "@gtkx/jsx/gtk";
13
- *
14
- * const App = () => (
15
- * <GtkApplication applicationId={applicationId}>
16
- * <GtkApplicationWindow title="Hello" defaultWidth={400} defaultHeight={300} />
17
- * </GtkApplication>
18
- * );
19
- * ```
20
- */
21
- export * from "virtual:gtkx-config";
22
- //# sourceMappingURL=runtime.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,wDAAwD;AAExD;;;;;;;;;;;;;;;;;;GAkBG;AACH,cAAc,qBAAqB,CAAC"}
@@ -1,36 +0,0 @@
1
- export type PropCondition = "defined" | "nonNull" | "truthy";
2
- export type SetterPropStep = {
3
- prop: string;
4
- call?: string;
5
- set?: string;
6
- when?: PropCondition;
7
- skipWhenGetterEquals?: string;
8
- requireGetterTruthyWithValue?: string;
9
- skipWhenGetterDivergedFromCommitted?: string;
10
- };
11
- export type SetterPropGroup = {
12
- kind: "setters";
13
- props: SetterPropStep[];
14
- always?: boolean;
15
- };
16
- export type SignalPropRule = {
17
- kind: "signal";
18
- prop: string;
19
- signal: string;
20
- noArgs?: boolean;
21
- returnValue?: unknown;
22
- };
23
- export type PropRule = SetterPropGroup | SignalPropRule;
24
- export type AddMethodArg = "widget" | "id" | "title" | "iconName";
25
- export type AddMethodRule = {
26
- method: string;
27
- args: AddMethodArg[];
28
- requires: AddMethodArg[];
29
- };
30
- export type PageMetaSetter = {
31
- setter: string;
32
- prop: string;
33
- fallback?: unknown;
34
- whenPresent?: boolean;
35
- };
36
- //# sourceMappingURL=table-rules-ir.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"table-rules-ir.d.ts","sourceRoot":"","sources":["../src/table-rules-ir.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE7D,MAAM,MAAM,cAAc,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,mCAAmC,CAAC,EAAE,MAAM,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,eAAe,GAAG,cAAc,CAAC;AAExD,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,IAAI,GAAG,OAAO,GAAG,UAAU,CAAC;AAElE,MAAM,MAAM,aAAa,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,YAAY,EAAE,CAAC;IACrB,QAAQ,EAAE,YAAY,EAAE,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=table-rules-ir.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"table-rules-ir.js","sourceRoot":"","sources":["../src/table-rules-ir.ts"],"names":[],"mappings":""}
@@ -1,107 +0,0 @@
1
- export type VerbArgs = "child" | "childName" | "null" | "prefixChild" | "prefixNull";
2
- export type DetachGuard = {
3
- side: "child" | "parent";
4
- getter: string;
5
- };
6
- export type MethodVerb = {
7
- kind: "method";
8
- attach: string;
9
- attachArgs: VerbArgs;
10
- detach: string;
11
- detachArgs: VerbArgs;
12
- detachGuard?: DetachGuard;
13
- };
14
- export type ContainerPropRow = {
15
- attach: string;
16
- attachArgs?: VerbArgs;
17
- detach?: string;
18
- detachArgs?: VerbArgs;
19
- detachGuard?: DetachGuard;
20
- };
21
- export type OrderedInsertVerb = {
22
- kind: "orderedInsert";
23
- attach: string;
24
- detach: string;
25
- collection: string;
26
- };
27
- export type AttachVerb = MethodVerb | OrderedInsertVerb;
28
- export type ElementMapRule = {
29
- child: string;
30
- parentType?: string;
31
- parentMethod?: string;
32
- verb: AttachVerb;
33
- };
34
- export type PresenceCondition = "defined" | "nonNull";
35
- export type CallArg = {
36
- kind: "item";
37
- path?: string;
38
- fallback?: unknown;
39
- } | {
40
- kind: "value";
41
- value: unknown;
42
- };
43
- export type CallStep = {
44
- method: string;
45
- args: CallArg[];
46
- when?: {
47
- path: string;
48
- is: PresenceCondition;
49
- };
50
- };
51
- export type ConstructSetter = {
52
- method: string;
53
- path: string;
54
- when: PresenceCondition;
55
- };
56
- export type ConstructStep = {
57
- type: string;
58
- setters: ConstructSetter[];
59
- attach: string;
60
- };
61
- export type ArrayPropRow = {
62
- itemType: string;
63
- clear?: string;
64
- remove?: CallStep;
65
- add?: CallStep[];
66
- construct?: ConstructStep;
67
- set?: string;
68
- appendOnce?: boolean;
69
- };
70
- export type ObjectPropRow = {
71
- itemType: string;
72
- set: CallStep[];
73
- unset?: CallStep[];
74
- };
75
- export type VirtualPropRow = {
76
- type: string;
77
- setter: string;
78
- after?: string;
79
- };
80
- export type PerElementPropRows<Row> = Record<string, Record<string, Row>>;
81
- /**
82
- * Names of the child-attachment method shapes a GObject type can satisfy. Each
83
- * shape corresponds to a runtime method whose presence *and* signature (argument
84
- * arity, parameter types, nullability) `@gtkx/codegen` verifies against the GIR
85
- * model, so the reconciler can rely on the call shape instead of duck-typing the
86
- * method name alone.
87
- */
88
- export type AttachShape = "append" | "add" | "setContent" | "setChild" | "getChild" | "remove" | "reorderChildAfter" | "insertChildAfter" | "insert" | "getFirstChild";
89
- /**
90
- * Maps a GLib type name to the verified {@link AttachShape}s its own methods
91
- * introduce. The reconciler resolves an instance's full shape set by unioning
92
- * the entries across its type-name chain and implemented interfaces.
93
- */
94
- export type AttachShapeTable = Record<string, AttachShape[]>;
95
- export type UserTableRows = {
96
- containerProps?: PerElementPropRows<ContainerPropRow> | undefined;
97
- arrayProps?: PerElementPropRows<ArrayPropRow> | undefined;
98
- objectProps?: PerElementPropRows<ObjectPropRow> | undefined;
99
- virtualProps?: PerElementPropRows<VirtualPropRow> | undefined;
100
- elementMap?: ElementMapRule[] | undefined;
101
- };
102
- export declare const validateContainerPropRows: (containerProps: unknown) => void;
103
- export declare const validateElementMap: (elementMap: unknown) => void;
104
- export declare const validateArrayPropRows: (arrayProps: unknown) => void;
105
- export declare const validateObjectPropRows: (objectProps: unknown) => void;
106
- export declare const validateVirtualPropRows: (virtualProps: unknown) => void;
107
- //# sourceMappingURL=table-schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"table-schema.d.ts","sourceRoot":"","sources":["../src/table-schema.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,WAAW,GAAG,MAAM,GAAG,aAAa,GAAG,YAAY,CAAC;AAErF,MAAM,MAAM,WAAW,GAAG;IAAE,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvE,MAAM,MAAM,UAAU,GAAG;IACrB,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,QAAQ,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,QAAQ,CAAC;IACrB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,QAAQ,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,QAAQ,CAAC;IACtB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC5B,IAAI,EAAE,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