Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename catalog entry to boxel spec #2102

Merged
merged 16 commits into from
Feb 3, 2025
2 changes: 1 addition & 1 deletion packages/base/card-api.gts
Original file line number Diff line number Diff line change
Expand Up @@ -1912,7 +1912,7 @@ export class CardDef extends BaseDef {
// we need to be careful that we don't trigger the ambient recompute() in our setters
// when we are instantiating an instance that is placed in the identityMap that has
// not had it's field values set yet, as computeds will be run that may assume dependent
// fields are available when they are not (e.g. CatalogEntry.isPrimitive trying to load
// fields are available when they are not (e.g. Spec.isPrimitive trying to load
// it's 'ref' field). In this scenario, only the 'id' field is available. the rest of the fields
// will be filled in later, so just set the 'id' directly in the deserialized cache to avoid
// triggering the recompute.
Expand Down
10 changes: 5 additions & 5 deletions packages/base/cards-grid.gts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { IconList, IconGrid } from '@cardstack/boxel-ui/icons';
import { eq, cn } from '@cardstack/boxel-ui/helpers';
import {
chooseCard,
catalogEntryRef,
specRef,
baseRealm,
isCardInstance,
SupportedMimeType,
Expand All @@ -36,7 +36,7 @@ import { tracked } from '@glimmer/tracking';
import { DropdownArrowDown } from '@cardstack/boxel-ui/icons';
// @ts-ignore no types
import cssUrl from 'ember-css-url';
import { type CatalogEntry } from './catalog-entry';
import { Spec } from './spec';
import StringField from './string';
import { TrackedArray } from 'tracked-built-ins';
import { MenuItem } from '@cardstack/boxel-ui/helpers';
Expand Down Expand Up @@ -381,7 +381,7 @@ class Isolated extends Component<typeof CardsGrid> {
if (activeFilterRef) {
preselectedCardTypeQuery = {
filter: {
on: catalogEntryRef,
on: specRef,
eq: { ref: activeFilterRef },
},
sort: [
Expand All @@ -392,10 +392,10 @@ class Isolated extends Component<typeof CardsGrid> {
],
};
}
let card = await chooseCard<CatalogEntry>(
let card = await chooseCard<Spec>(
{
filter: {
on: catalogEntryRef,
on: specRef,
every: [{ eq: { isCard: true } }],
},
},
Expand Down
4 changes: 2 additions & 2 deletions packages/base/fields/base64-image.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
},
"meta": {
"adoptsFrom": {
"module": "https://cardstack.com/base/catalog-entry",
"name": "CatalogEntry"
"module": "https://cardstack.com/base/spec",
"name": "Spec"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/base/fields/biginteger-field.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
},
"meta": {
"adoptsFrom": {
"module": "https://cardstack.com/base/catalog-entry",
"name": "CatalogEntry"
"module": "https://cardstack.com/base/spec",
"name": "Spec"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/base/fields/boolean-field.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
},
"meta": {
"adoptsFrom": {
"module": "https://cardstack.com/base/catalog-entry",
"name": "CatalogEntry"
"module": "https://cardstack.com/base/spec",
"name": "Spec"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/base/fields/code-ref-field.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
},
"meta": {
"adoptsFrom": {
"module": "https://cardstack.com/base/catalog-entry",
"name": "CatalogEntry"
"module": "https://cardstack.com/base/spec",
"name": "Spec"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/base/fields/date-field.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
},
"meta": {
"adoptsFrom": {
"module": "https://cardstack.com/base/catalog-entry",
"name": "CatalogEntry"
"module": "https://cardstack.com/base/spec",
"name": "Spec"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/base/fields/datetime-field.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
},
"meta": {
"adoptsFrom": {
"module": "https://cardstack.com/base/catalog-entry",
"name": "CatalogEntry"
"module": "https://cardstack.com/base/spec",
"name": "Spec"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/base/fields/ethereum-address-field.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
},
"meta": {
"adoptsFrom": {
"module": "https://cardstack.com/base/catalog-entry",
"name": "CatalogEntry"
"module": "https://cardstack.com/base/spec",
"name": "Spec"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/base/fields/field.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
},
"meta": {
"adoptsFrom": {
"module": "https://cardstack.com/base/catalog-entry",
"name": "CatalogEntry"
"module": "https://cardstack.com/base/spec",
"name": "Spec"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/base/fields/markdown-field.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
},
"meta": {
"adoptsFrom": {
"module": "https://cardstack.com/base/catalog-entry",
"name": "CatalogEntry"
"module": "https://cardstack.com/base/spec",
"name": "Spec"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/base/fields/number-field.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
},
"meta": {
"adoptsFrom": {
"module": "https://cardstack.com/base/catalog-entry",
"name": "CatalogEntry"
"module": "https://cardstack.com/base/spec",
"name": "Spec"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/base/fields/skill-card.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
},
"meta": {
"adoptsFrom": {
"module": "https://cardstack.com/base/catalog-entry",
"name": "CatalogEntry"
"module": "https://cardstack.com/base/spec",
"name": "Spec"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/base/fields/string-field.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
},
"meta": {
"adoptsFrom": {
"module": "https://cardstack.com/base/catalog-entry",
"name": "CatalogEntry"
"module": "https://cardstack.com/base/spec",
"name": "Spec"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/base/fields/text-area-field.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
},
"meta": {
"adoptsFrom": {
"module": "https://cardstack.com/base/catalog-entry",
"name": "CatalogEntry"
"module": "https://cardstack.com/base/spec",
"name": "Spec"
}
}
}
Expand Down
20 changes: 10 additions & 10 deletions packages/base/catalog-entry.gts → packages/base/spec.gts
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,29 @@ import AppsIcon from '@cardstack/boxel-icons/apps';
import LayoutList from '@cardstack/boxel-icons/layout-list';
import Brain from '@cardstack/boxel-icons/brain';

export type BoxelSpecType = 'card' | 'field' | 'app' | 'skill';
export type SpecType = 'card' | 'field' | 'app' | 'skill';

export class SpecType extends StringField {
class SpecTypeField extends StringField {
static displayName = 'Spec Type';
}

export class CatalogEntry extends CardDef {
static displayName = 'Catalog Entry';
export class Spec extends CardDef {
static displayName = 'Spec';
static icon = BoxModel;
@field name = contains(StringField);
@field readMe = contains(MarkdownField);

@field ref = contains(CodeRef);
@field specType = contains(SpecType);
@field specType = contains(SpecTypeField);

@field isField = contains(BooleanField, {
computeVia: function (this: CatalogEntry) {
computeVia: function (this: Spec) {
return this.specType === 'field';
},
});

@field isCard = contains(BooleanField, {
computeVia: function (this: CatalogEntry) {
computeVia: function (this: Spec) {
return (
this.specType === 'card' ||
this.specType === 'app' ||
Expand All @@ -66,14 +66,14 @@ export class CatalogEntry extends CardDef {
},
});
@field moduleHref = contains(StringField, {
computeVia: function (this: CatalogEntry) {
computeVia: function (this: Spec) {
return new URL(this.ref.module, this[relativeTo]).href;
},
});
@field linkedExamples = linksToMany(CardDef);
@field containedExamples = containsMany(FieldDef, { isUsed: true });
@field title = contains(StringField, {
computeVia: function (this: CatalogEntry) {
computeVia: function (this: Spec) {
if (this.name) {
return this.name;
}
Expand Down Expand Up @@ -342,7 +342,7 @@ export class CatalogEntry extends CardDef {
</template>
};

static edit = CatalogEntry.isolated;
static edit = Spec.isolated;
}

interface SpecTagSignature {
Expand Down
4 changes: 2 additions & 2 deletions packages/base/types/card.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
},
"meta": {
"adoptsFrom": {
"module": "https://cardstack.com/base/catalog-entry",
"name": "CatalogEntry"
"module": "https://cardstack.com/base/spec",
"name": "Spec"
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/experiments-realm/CatalogEntry/1.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "card",
"attributes": {
"title": "Person",
"description": "Catalog entry for Person card",
"description": "Spec for Person card",
"specType": "card",
"ref": {
"module": "../person",
Expand All @@ -12,8 +12,8 @@
},
"meta": {
"adoptsFrom": {
"module": "https://cardstack.com/base/catalog-entry",
"name": "CatalogEntry"
"module": "https://cardstack.com/base/spec",
"name": "Spec"
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/experiments-realm/CatalogEntry/10.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "card",
"attributes": {
"title": "Friends from ../friends",
"description": "Catalog entry for Friends from ../friends",
"description": "Spec for Friends from ../friends",
"specType": "card",
"ref": {
"module": "../friends",
Expand All @@ -12,8 +12,8 @@
},
"meta": {
"adoptsFrom": {
"module": "https://cardstack.com/base/catalog-entry",
"name": "CatalogEntry"
"module": "https://cardstack.com/base/spec",
"name": "Spec"
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/experiments-realm/CatalogEntry/11.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "card",
"attributes": {
"title": "ContactCard",
"description": "Catalog entry for ContactCard",
"description": "Spec for ContactCard",
"specType": "card",
"ref": {
"module": "../contact-card",
Expand All @@ -12,8 +12,8 @@
},
"meta": {
"adoptsFrom": {
"module": "https://cardstack.com/base/catalog-entry",
"name": "CatalogEntry"
"module": "https://cardstack.com/base/spec",
"name": "Spec"
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/experiments-realm/CatalogEntry/2.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"data": {
"attributes": {
"title": "Pet",
"description": "Catalog entry for Pet card",
"description": "Spec for Pet card",
"ref": {
"module": "../pet",
"name": "Pet"
Expand All @@ -11,8 +11,8 @@
},
"meta": {
"adoptsFrom": {
"module": "https://cardstack.com/base/catalog-entry",
"name": "CatalogEntry"
"module": "https://cardstack.com/base/spec",
"name": "Spec"
}
},
"type": "card"
Expand Down
6 changes: 3 additions & 3 deletions packages/experiments-realm/CatalogEntry/6.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "card",
"attributes": {
"title": "Friend from /friend",
"description": "Catalog entry for Friend from /friend",
"description": "Spec for Friend from /friend",
"specType": "card",
"ref": {
"module": "../friend",
Expand All @@ -12,8 +12,8 @@
},
"meta": {
"adoptsFrom": {
"module": "https://cardstack.com/base/catalog-entry",
"name": "CatalogEntry"
"module": "https://cardstack.com/base/spec",
"name": "Spec"
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/experiments-realm/CatalogEntry/7.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "card",
"attributes": {
"title": "Booking Card",
"description": "Catalog entry for Booking Card",
"description": "Spec for Booking Card",
"specType": "card",
"ref": {
"module": "../booking",
Expand All @@ -12,8 +12,8 @@
},
"meta": {
"adoptsFrom": {
"module": "https://cardstack.com/base/catalog-entry",
"name": "CatalogEntry"
"module": "https://cardstack.com/base/spec",
"name": "Spec"
}
}
}
Expand Down
Loading