Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions BoomPerson/0c913960-4621-4ae7-a557-28dd19dc343f.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"data": {
"type": "card",
"attributes": {
"firstName": null,
"title": null,
"description": null,
"thumbnailURL": null
},
"meta": {
"adoptsFrom": {
"module": "../boom-pet",
"name": "BoomPerson"
}
}
}
}
74 changes: 74 additions & 0 deletions CardListing/d78dedbc-d3d9-44e6-b97f-38569241a940.json
Original file line number Diff line number Diff line change
@@ -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
}
}
}
}
}
40 changes: 40 additions & 0 deletions Spec/11bad32e-304b-440a-9b77-51ab49a5c79d.json
Original file line number Diff line number Diff line change
@@ -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<template>\n <h3>Boom Person</h3>\n <@fields.boomPerson as |person|>\n <p>Hello, {{person.firstName}}!</p>\n </@fields.boomPerson>\n</template>\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
}
}
}
}
}
62 changes: 62 additions & 0 deletions boom-pet.gts
Original file line number Diff line number Diff line change
@@ -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<typeof this> {
<template>
<@fields.cardTitle />
</template>
};
}

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<typeof this> {
<template>
Hello
<@fields.firstName />!
{{!-- {{this.causeError}} --}}
</template>
// causeError = () => fn();
};
}

export class WorkingCard extends CardDef {
static displayName = 'Working Card';
static isolated = class Isolated extends Component<typeof this> {
<template>
<p>I am not broken!</p>
</template>
};
}

export class FailingField extends FieldDef {
static displayName = 'Failing Field';
@field cardTitle = contains(StringField);
static embedded = class Embedded extends Component<typeof this> {
<template>
<p>This will fail.</p> {{this.boom}}
</template>
boom = () => {
throw new Error('boom!');
};
};
}
Loading