@alloy-js/json 0.16.0 → 0.17.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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog - @alloy-js/json
2
2
 
3
+ ## 0.17.0
4
+
5
+ No changes, version bump only.
6
+
3
7
  ## 0.16.0
4
8
 
5
9
  No changes, version bump only.
@@ -1 +1 @@
1
- {"version":3,"file":"JsonArray.d.ts","sourceRoot":"","sources":["../../../src/components/JsonArray.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQR,MAAM,EAGP,MAAM,gBAAgB,CAAC;AAIxB,MAAM,WAAW,kBAAkB;IACjC;;;QAGI;IACJ,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,kBAAkB;IACnE;;OAEG;IACH,OAAO,EAAE,OAAO,EAAE,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,0BAA2B,SAAQ,kBAAkB;IACpE;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,MAAM,MAAM,cAAc,GACtB,yBAAyB,GACzB,0BAA0B,CAAC;AAE/B;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,YA0C9C;AAED;;;GAGG;AACH,MAAM,WAAW,gCAAgC;IAC/C,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,iCAAiC;IAChD,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,MAAM,MAAM,qBAAqB,GAC7B,gCAAgC,GAChC,iCAAiC,CAAC;AAEtC;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,YA6B5D"}
1
+ {"version":3,"file":"JsonArray.d.ts","sourceRoot":"","sources":["../../../src/components/JsonArray.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQR,MAAM,EAGP,MAAM,gBAAgB,CAAC;AAIxB,MAAM,WAAW,kBAAkB;IACjC;;;QAGI;IACJ,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,kBAAkB;IACnE;;OAEG;IACH,OAAO,EAAE,OAAO,EAAE,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,0BAA2B,SAAQ,kBAAkB;IACpE;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,MAAM,MAAM,cAAc,GACtB,yBAAyB,GACzB,0BAA0B,CAAC;AAE/B;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,YA0C9C;AAED;;;GAGG;AACH,MAAM,WAAW,gCAAgC;IAC/C,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,iCAAiC;IAChD,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,MAAM,MAAM,qBAAqB,GAC7B,gCAAgC,GAChC,iCAAiC,CAAC;AAEtC;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,YA4B5D"}
@@ -1,6 +1,6 @@
1
1
  import { memo as _$memo, createComponent as _$createComponent, createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
2
2
  import { For, Indent, List, MemberDeclaration, MemberScope, onCleanup, OutputSymbolFlags, useMemberDeclaration, useMemberScope } from "@alloy-js/core";
3
- import { createJsonOutputSymbol } from "../symbols/json-symbol.js";
3
+ import { JsonOutputSymbol } from "../symbols/json-symbol.js";
4
4
  import { JsonValue } from "./JsonValue.js";
5
5
 
6
6
  /**
@@ -23,8 +23,7 @@ export function JsonArray(props) {
23
23
  if (!memberSymbol) {
24
24
  throw new Error("Missing assignment symbol.");
25
25
  }
26
- const binder = memberSymbol.binder;
27
- binder.addStaticMembersToSymbol(memberSymbol);
26
+ memberSymbol.flags |= OutputSymbolFlags.StaticMemberContainer;
28
27
  if (props.refkey) {
29
28
  memberSymbol.refkeys = [props.refkey].flat();
30
29
  }
@@ -103,12 +102,11 @@ export function JsonArrayElement(props) {
103
102
  throw new Error("Missing static members scope.");
104
103
  }
105
104
  const name = String(memberScope.staticMembers.symbols.size);
106
- const sym = createJsonOutputSymbol({
107
- name,
105
+ const sym = new JsonOutputSymbol(name, {
108
106
  flags: OutputSymbolFlags.StaticMember
109
107
  });
110
108
  onCleanup(() => {
111
- sym.binder.deleteSymbol(sym);
109
+ sym.delete();
112
110
  });
113
111
  function wrap(children) {
114
112
  return _$createComponent(MemberDeclaration, {
@@ -1 +1 @@
1
- {"version":3,"file":"JsonObject.d.ts","sourceRoot":"","sources":["../../../src/components/JsonObject.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EASR,MAAM,EAEP,MAAM,gBAAgB,CAAC;AAIxB,MAAM,WAAW,mBAAmB;IAClC;;;QAGI;IACJ,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE3B,KAAK,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CAC/B;AAED;;;;GAIG;AACH,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB;IACtE;;;OAGG;IACH,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,mBAAmB;IACrE;;;OAGG;IACH,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/E;AAED,MAAM,MAAM,eAAe,GACvB,2BAA2B,GAC3B,0BAA0B,CAAC;AAE/B;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,YA+DhD;AAED;;;GAGG;AACH,MAAM,WAAW,+BAA+B;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,8BAA8B;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,MAAM,mBAAmB,GAC3B,+BAA+B,GAC/B,8BAA8B,CAAC;AAEnC;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,mBAAmB,YAuB5D"}
1
+ {"version":3,"file":"JsonObject.d.ts","sourceRoot":"","sources":["../../../src/components/JsonObject.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EASR,MAAM,EAEP,MAAM,gBAAgB,CAAC;AAIxB,MAAM,WAAW,mBAAmB;IAClC;;;QAGI;IACJ,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE3B,KAAK,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CAC/B;AAED;;;;GAIG;AACH,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB;IACtE;;;OAGG;IACH,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,mBAAmB;IACrE;;;OAGG;IACH,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/E;AAED,MAAM,MAAM,eAAe,GACvB,2BAA2B,GAC3B,0BAA0B,CAAC;AAE/B;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,YA+DhD;AAED;;;GAGG;AACH,MAAM,WAAW,+BAA+B;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,8BAA8B;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,MAAM,mBAAmB,GAC3B,+BAA+B,GAC/B,8BAA8B,CAAC;AAEnC;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,mBAAmB,YAsB5D"}
@@ -1,6 +1,6 @@
1
1
  import { memo as _$memo, createComponent as _$createComponent, createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
2
2
  import { computed, For, Indent, List, MemberDeclaration, MemberScope, onCleanup, OutputSymbolFlags, useMemberDeclaration } from "@alloy-js/core";
3
- import { createJsonOutputSymbol } from "../symbols/json-symbol.js";
3
+ import { JsonOutputSymbol } from "../symbols/json-symbol.js";
4
4
  import { JsonValue } from "./JsonValue.js";
5
5
 
6
6
  /**
@@ -25,8 +25,7 @@ export function JsonObject(props) {
25
25
  if (!memberSymbol) {
26
26
  throw new Error("Missing assignment symbol.");
27
27
  }
28
- const binder = memberSymbol.binder;
29
- binder.addStaticMembersToSymbol(memberSymbol);
28
+ memberSymbol.flags |= OutputSymbolFlags.StaticMemberContainer;
30
29
  if (props.refkey) {
31
30
  memberSymbol.refkeys = [props.refkey].flat();
32
31
  }
@@ -119,12 +118,11 @@ export function JsonObject(props) {
119
118
  * @see {@link @alloy-js/core#(MemberDeclarationContext:variable)}
120
119
  */
121
120
  export function JsonObjectProperty(props) {
122
- const sym = createJsonOutputSymbol({
123
- name: props.name,
121
+ const sym = new JsonOutputSymbol(props.name, {
124
122
  flags: OutputSymbolFlags.StaticMember
125
123
  });
126
124
  onCleanup(() => {
127
- sym.binder.deleteSymbol(sym);
125
+ sym.delete();
128
126
  });
129
127
  const wrap = children => {
130
128
  return _$createComponent(MemberDeclaration, {
@@ -17,5 +17,5 @@ export interface JsonValueProps {
17
17
  * value will be serialized to a string, number, boolean, or null as
18
18
  * appropriate.
19
19
  */
20
- export declare function JsonValue(props: JsonValueProps): import("@alloy-js/core").Children;
20
+ export declare function JsonValue(props: JsonValueProps): import("@alloy-js/core/jsx-runtime").Children;
21
21
  //# sourceMappingURL=JsonValue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"JsonValue.d.ts","sourceRoot":"","sources":["../../../src/components/JsonValue.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAwB,MAAM,gBAAgB,CAAC;AAI9D,MAAM,WAAW,cAAc;IAC7B;;;QAGI;IACJ,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE3B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,qCA0B9C"}
1
+ {"version":3,"file":"JsonValue.d.ts","sourceRoot":"","sources":["../../../src/components/JsonValue.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAwB,MAAM,gBAAgB,CAAC;AAI9D,MAAM,WAAW,cAAc;IAC7B;;;QAGI;IACJ,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE3B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,iDA0B9C"}
@@ -14,5 +14,5 @@ export interface ReferenceProps {
14
14
  * into a reference automatically. Using this component directly is generally
15
15
  * not required or recommended.
16
16
  */
17
- export declare function Reference(props: ReferenceProps): import("@alloy-js/core").Children;
17
+ export declare function Reference(props: ReferenceProps): import("@alloy-js/core/jsx-runtime").Children;
18
18
  //# sourceMappingURL=Reference.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Reference.d.ts","sourceRoot":"","sources":["../../../src/components/Reference.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGxC,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,qCAG9C"}
1
+ {"version":3,"file":"Reference.d.ts","sourceRoot":"","sources":["../../../src/components/Reference.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGxC,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,iDAG9C"}
@@ -1 +1 @@
1
- {"version":3,"file":"SourceFile.d.ts","sourceRoot":"","sources":["../../../src/components/SourceFile.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAIT,MAAM,gBAAgB,CAAC;AAKxB,MAAM,WAAW,eAAe;IAC9B,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IAEb,sCAAsC;IACtC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,YAwBhD"}
1
+ {"version":3,"file":"SourceFile.d.ts","sourceRoot":"","sources":["../../../src/components/SourceFile.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAIT,MAAM,gBAAgB,CAAC;AAKxB,MAAM,WAAW,eAAe;IAC9B,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IAEb,sCAAsC;IACtC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,YAsBhD"}
@@ -1,7 +1,7 @@
1
1
  import { createComponent as _$createComponent, memo as _$memo } from "@alloy-js/core/jsx-runtime";
2
2
  import { SourceFile as CoreSourceFile, createSourceFileTap, MemberDeclaration } from "@alloy-js/core";
3
3
  import { JsonFileContext } from "../context/JsonFileContext.js";
4
- import { createJsonOutputSymbol } from "../symbols/json-symbol.js";
4
+ import { JsonOutputSymbol } from "../symbols/json-symbol.js";
5
5
  import { Reference } from "./Reference.js";
6
6
  /**
7
7
  * Creates a JSON source file which defines a JSON value.
@@ -12,9 +12,7 @@ import { Reference } from "./Reference.js";
12
12
  *
13
13
  */
14
14
  export function SourceFile(props) {
15
- const jsonValueSym = createJsonOutputSymbol({
16
- name: ""
17
- });
15
+ const jsonValueSym = new JsonOutputSymbol("");
18
16
  const fileContext = {
19
17
  symbol: jsonValueSym,
20
18
  path: props.path
@@ -1,9 +1,10 @@
1
+ import * as core from "@alloy-js/core";
1
2
  import * as Jsx from "../index.js";
2
- export declare const JsonArray: import("@alloy-js/core").StcSignature<Jsx.JsonArrayProps>;
3
- export declare const JsonArrayElement: import("@alloy-js/core").StcSignature<Jsx.JsonArrayElementProps>;
4
- export declare const JsonObject: import("@alloy-js/core").StcSignature<Jsx.JsonObjectProps>;
5
- export declare const JsonObjectProperty: import("@alloy-js/core").StcSignature<Jsx.ObjectPropertyProps>;
6
- export declare const JsonValue: import("@alloy-js/core").StcSignature<Jsx.JsonValueProps>;
7
- export declare const Reference: import("@alloy-js/core").StcSignature<Jsx.ReferenceProps>;
8
- export declare const SourceFile: import("@alloy-js/core").StcSignature<Jsx.SourceFileProps>;
3
+ export declare const JsonArray: core.StcSignature<Jsx.JsonArrayProps>;
4
+ export declare const JsonArrayElement: core.StcSignature<Jsx.JsonArrayElementProps>;
5
+ export declare const JsonObject: core.StcSignature<Jsx.JsonObjectProps>;
6
+ export declare const JsonObjectProperty: core.StcSignature<Jsx.ObjectPropertyProps>;
7
+ export declare const JsonValue: core.StcSignature<Jsx.JsonValueProps>;
8
+ export declare const Reference: core.StcSignature<Jsx.ReferenceProps>;
9
+ export declare const SourceFile: core.StcSignature<Jsx.SourceFileProps>;
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/stc/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AAEnC,eAAO,MAAM,SAAS,2DAAqB,CAAC;AAC5C,eAAO,MAAM,gBAAgB,kEAA4B,CAAC;AAC1D,eAAO,MAAM,UAAU,4DAAsB,CAAC;AAC9C,eAAO,MAAM,kBAAkB,gEAA8B,CAAC;AAC9D,eAAO,MAAM,SAAS,2DAAqB,CAAC;AAC5C,eAAO,MAAM,SAAS,2DAAqB,CAAC;AAC5C,eAAO,MAAM,UAAU,4DAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/stc/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AAEnC,eAAO,MAAM,SAAS,uCAA0B,CAAC;AACjD,eAAO,MAAM,gBAAgB,8CAAiC,CAAC;AAC/D,eAAO,MAAM,UAAU,wCAA2B,CAAC;AACnD,eAAO,MAAM,kBAAkB,4CAAmC,CAAC;AACnE,eAAO,MAAM,SAAS,uCAA0B,CAAC;AACjD,eAAO,MAAM,SAAS,uCAA0B,CAAC;AACjD,eAAO,MAAM,UAAU,wCAA2B,CAAC"}
@@ -1,9 +1,9 @@
1
- import { stc } from "@alloy-js/core";
1
+ import * as core from "@alloy-js/core";
2
2
  import * as Jsx from "../index.js";
3
- export const JsonArray = stc(Jsx.JsonArray);
4
- export const JsonArrayElement = stc(Jsx.JsonArrayElement);
5
- export const JsonObject = stc(Jsx.JsonObject);
6
- export const JsonObjectProperty = stc(Jsx.JsonObjectProperty);
7
- export const JsonValue = stc(Jsx.JsonValue);
8
- export const Reference = stc(Jsx.Reference);
9
- export const SourceFile = stc(Jsx.SourceFile);
3
+ export const JsonArray = core.stc(Jsx.JsonArray);
4
+ export const JsonArrayElement = core.stc(Jsx.JsonArrayElement);
5
+ export const JsonObject = core.stc(Jsx.JsonObject);
6
+ export const JsonObjectProperty = core.stc(Jsx.JsonObjectProperty);
7
+ export const JsonValue = core.stc(Jsx.JsonValue);
8
+ export const Reference = core.stc(Jsx.Reference);
9
+ export const SourceFile = core.stc(Jsx.SourceFile);
@@ -1,4 +1,4 @@
1
- import { CreateSymbolOptions, OutputScope, OutputSymbol, OutputSymbolFlags } from "@alloy-js/core";
1
+ import { OutputSymbol, OutputSymbolOptions } from "@alloy-js/core";
2
2
  export declare enum JsonSymbolFlags {
3
3
  None = 0,
4
4
  Object = 1,
@@ -10,13 +10,13 @@ export declare enum JsonSymbolFlags {
10
10
  * values that are members of an object or an array, the symbol will have the
11
11
  * `StaticMember` flag.
12
12
  */
13
- export interface JsonOutputSymbol extends OutputSymbol {
14
- scope: OutputScope;
15
- jsonFlags: JsonSymbolFlags;
13
+ export declare class JsonOutputSymbol extends OutputSymbol {
14
+ #private;
15
+ get jsonFlags(): JsonSymbolFlags;
16
+ set jsonFlags(value: JsonSymbolFlags);
17
+ constructor(name: string, options?: CreateJsonSymbolOptions);
16
18
  }
17
- export interface createJsonSymbolOptions extends CreateSymbolOptions {
19
+ export interface CreateJsonSymbolOptions extends OutputSymbolOptions {
18
20
  jsonFlags?: JsonSymbolFlags;
19
21
  }
20
- export declare function createJsonOutputSymbol(options: createJsonSymbolOptions): JsonOutputSymbol;
21
- export declare function useDefaultScope(flags?: OutputSymbolFlags): OutputScope | undefined;
22
22
  //# sourceMappingURL=json-symbol.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"json-symbol.d.ts","sourceRoot":"","sources":["../../../src/symbols/json-symbol.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,iBAAiB,EAGlB,MAAM,gBAAgB,CAAC;AAGxB,oBAAY,eAAe;IACzB,IAAI,IAAI;IACR,MAAM,IAAS;IACf,KAAK,IAAS;CACf;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,KAAK,EAAE,WAAW,CAAC;IACnB,SAAS,EAAE,eAAe,CAAC;CAC5B;AAED,MAAM,WAAW,uBAAwB,SAAQ,mBAAmB;IAClE,SAAS,CAAC,EAAE,eAAe,CAAC;CAC7B;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,uBAAuB,GAC/B,gBAAgB,CAgBlB;AAED,wBAAgB,eAAe,CAC7B,KAAK,GAAE,iBAA0C,2BAelD"}
1
+ {"version":3,"file":"json-symbol.d.ts","sourceRoot":"","sources":["../../../src/symbols/json-symbol.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,mBAAmB,EAKpB,MAAM,gBAAgB,CAAC;AAGxB,oBAAY,eAAe;IACzB,IAAI,IAAI;IACR,MAAM,IAAS;IACf,KAAK,IAAS;CACf;AAED;;;;;GAKG;AACH,qBAAa,gBAAiB,SAAQ,YAAY;;IAEhD,IAAI,SAAS,IAAI,eAAe,CAG/B;IAED,IAAI,SAAS,CAAC,KAAK,EAAE,eAAe,EAQnC;gBAEW,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,uBAA4B;CAKhE;AAED,MAAM,WAAW,uBAAwB,SAAQ,mBAAmB;IAClE,SAAS,CAAC,EAAE,eAAe,CAAC;CAC7B"}
@@ -1,4 +1,4 @@
1
- import { OutputSymbolFlags, useBinder, useMemberScope } from "@alloy-js/core";
1
+ import { OutputSymbol, track, TrackOpTypes, trigger, TriggerOpTypes } from "@alloy-js/core";
2
2
 
3
3
  // prettier-ignore
4
4
  export let JsonSymbolFlags = /*#__PURE__*/function (JsonSymbolFlags) {
@@ -14,31 +14,22 @@ export let JsonSymbolFlags = /*#__PURE__*/function (JsonSymbolFlags) {
14
14
  * values that are members of an object or an array, the symbol will have the
15
15
  * `StaticMember` flag.
16
16
  */
17
-
18
- export function createJsonOutputSymbol(options) {
19
- const scope = options.scope ?? useDefaultScope(options.flags) ?? useBinder().globalScope;
20
- const binder = scope.binder;
21
- const sym = binder.createSymbol({
22
- name: options.name,
23
- scope,
24
- refkey: options.refkey,
25
- flags: options.flags ?? OutputSymbolFlags.None,
26
- jsonFlags: options.jsonFlags ?? JsonSymbolFlags.None
27
- });
28
- return sym;
29
- }
30
- export function useDefaultScope(flags = OutputSymbolFlags.None) {
31
- if ((flags & OutputSymbolFlags.Member) === 0) {
32
- return useBinder().globalScope;
33
- } else {
34
- const memberScope = useMemberScope();
35
- if (!memberScope) {
36
- throw new Error("Cannot declare member symbols without a member scope");
37
- }
38
- if (flags & OutputSymbolFlags.InstanceMember) {
39
- return memberScope.instanceMembers;
40
- } else {
41
- return memberScope.staticMembers;
17
+ export class JsonOutputSymbol extends OutputSymbol {
18
+ #jsonFlags;
19
+ get jsonFlags() {
20
+ track(this, TrackOpTypes.GET, "jsonFlags");
21
+ return this.#jsonFlags;
22
+ }
23
+ set jsonFlags(value) {
24
+ const old = this.#jsonFlags;
25
+ if (old === value) {
26
+ return;
42
27
  }
28
+ this.#jsonFlags = value;
29
+ trigger(this, TriggerOpTypes.SET, "jsonFlags", value, old);
30
+ }
31
+ constructor(name, options = {}) {
32
+ super(name, options);
33
+ this.#jsonFlags = options.jsonFlags ?? JsonSymbolFlags.None;
43
34
  }
44
35
  }