diff --git a/BoomPerson/0c913960-4621-4ae7-a557-28dd19dc343f.json b/BoomPerson/0c913960-4621-4ae7-a557-28dd19dc343f.json new file mode 100644 index 0000000..a10d037 --- /dev/null +++ b/BoomPerson/0c913960-4621-4ae7-a557-28dd19dc343f.json @@ -0,0 +1,17 @@ +{ + "data": { + "type": "card", + "attributes": { + "firstName": null, + "title": null, + "description": null, + "thumbnailURL": null + }, + "meta": { + "adoptsFrom": { + "module": "../boom-pet", + "name": "BoomPerson" + } + } + } +} \ No newline at end of file diff --git a/CardListing/d78dedbc-d3d9-44e6-b97f-38569241a940.json b/CardListing/d78dedbc-d3d9-44e6-b97f-38569241a940.json new file mode 100644 index 0000000..09235a6 --- /dev/null +++ b/CardListing/d78dedbc-d3d9-44e6-b97f-38569241a940.json @@ -0,0 +1,74 @@ +{ + "data": { + "meta": { + "adoptsFrom": { + "name": "CardListing", + "module": "https://realms-staging.stack.cards/catalog/catalog-app/listing/listing" + } + }, + "type": "card", + "attributes": { + "name": "Boom Person", + "images": [], + "summary": "The BoomPerson card defines a simple data structure representing a person with a first name. Its primary purpose is to serve as a card type within the system that captures basic personal information. The card includes a single string field for the first name and provides an isolated component that displays a greeting message combining static text with the person's name. This setup facilitates the creation and display of person entities in applications, primarily focusing on data organization and presentation within the card system.", + "cardInfo": { + "name": null, + "notes": null, + "summary": null, + "cardThumbnailURL": null + } + }, + "relationships": { + "specs.0": { + "links": { + "self": "../Spec/11bad32e-304b-440a-9b77-51ab49a5c79d" + } + }, + "skills": { + "links": { + "self": null + } + }, + "tags.0": { + "links": { + "self": "https://realms-staging.stack.cards/catalog/Tag/51de249c-516a-4c4d-bd88-76e88274c483" + } + }, + "tags.1": { + "links": { + "self": "https://realms-staging.stack.cards/catalog/Tag/c1fe433a-b3df-41f4-bdcf-d98686ee42d7" + } + }, + "license": { + "links": { + "self": "https://realms-staging.stack.cards/catalog/License/4c5a023b-a72c-4f90-930b-da60a1de5b2d" + } + }, + "publisher": { + "links": { + "self": null + } + }, + "examples.0": { + "links": { + "self": "../BoomPerson/0c913960-4621-4ae7-a557-28dd19dc343f" + } + }, + "categories.0": { + "links": { + "self": "https://realms-staging.stack.cards/catalog/Category/ai-automation" + } + }, + "categories.1": { + "links": { + "self": "https://realms-staging.stack.cards/catalog/Category/design-creative" + } + }, + "cardInfo.theme": { + "links": { + "self": null + } + } + } + } +} \ No newline at end of file diff --git a/Spec/11bad32e-304b-440a-9b77-51ab49a5c79d.json b/Spec/11bad32e-304b-440a-9b77-51ab49a5c79d.json new file mode 100644 index 0000000..3f62986 --- /dev/null +++ b/Spec/11bad32e-304b-440a-9b77-51ab49a5c79d.json @@ -0,0 +1,40 @@ +{ + "data": { + "meta": { + "adoptsFrom": { + "name": "Spec", + "module": "https://cardstack.com/base/spec" + } + }, + "type": "card", + "attributes": { + "ref": { + "name": "BoomPerson", + "module": "../boom-pet" + }, + "readMe": "# BoomPerson Card Spec\n\n## Summary\n\nThe `BoomPerson` card spec defines a card that represents a person, with a `firstName` field. It also contains a `BoomField` which is designed to explode when serialized.\n\n## Import\n\n```javascript\nimport { BoomPerson } from 'https://realms-staging.stack.cards/experiments/boom-pet';\n```\n\n## Usage as a Field\n\nTo use the `BoomPerson` card as a field within a consuming card or field, you can add it as a `contains` field:\n\n```javascript\nimport {\n contains,\n field,\n CardDef,\n FieldDef,\n StringField,\n} from 'https://cardstack.com/base/card-api';\n\nexport class ConsumingCard extends CardDef {\n @field boomPerson = contains(BoomPerson);\n}\n```\n\n## Template Usage\n\nTo display a `BoomPerson` card within a template, you can use the `@fields.firstName` helper:\n\n```html\n\n```", + "cardInfo": { + "name": null, + "notes": null, + "summary": null, + "cardThumbnailURL": null + }, + "specType": "card", + "cardTitle": "Boom Person", + "cardDescription": null, + "containedExamples": [] + }, + "relationships": { + "cardInfo.theme": { + "links": { + "self": null + } + }, + "linkedExamples": { + "links": { + "self": null + } + } + } + } +} \ No newline at end of file diff --git a/boom-pet.gts b/boom-pet.gts new file mode 100644 index 0000000..303124f --- /dev/null +++ b/boom-pet.gts @@ -0,0 +1,62 @@ +import { + contains, + field, + CardDef, + Component, + FieldDef, + StringField, + serialize, +} from 'https://cardstack.com/base/card-api'; + +// this field explodes when serialized (saved) +export class BoomField extends FieldDef { + @field cardTitle = contains(StringField); + static [serialize](_boom: any) { + throw new Error('Boom!'); + } + static embedded = class Embedded extends Component { + + }; +} + +export class BoomPet extends CardDef { + static displayName = 'Boom Pet'; + @field boom = contains(BoomField); +} + +export class BoomPerson extends CardDef { + static displayName = 'Boom Person'; + @field firstName = contains(StringField); + static isolated = class Isolated extends Component { + + // causeError = () => fn(); + }; +} + +export class WorkingCard extends CardDef { + static displayName = 'Working Card'; + static isolated = class Isolated extends Component { + + }; +} + +export class FailingField extends FieldDef { + static displayName = 'Failing Field'; + @field cardTitle = contains(StringField); + static embedded = class Embedded extends Component { + + boom = () => { + throw new Error('boom!'); + }; + }; +}