@things-factory/integration-label-studio 10.0.4 → 10.0.5
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.
|
@@ -39,6 +39,8 @@ export class LabelStudioProjectCreate extends PageView {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
textarea {
|
|
42
|
+
background-color: var(--input-field-background, var(--md-sys-color-surface-container-highest));
|
|
43
|
+
color: var(--input-field-color, var(--md-sys-color-on-surface));
|
|
42
44
|
width: 100%;
|
|
43
45
|
min-height: 200px;
|
|
44
46
|
padding: 12px;
|
|
@@ -46,6 +46,8 @@ let LabelStudioProjectCreate = class LabelStudioProjectCreate extends PageView {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
textarea {
|
|
49
|
+
background-color: var(--input-field-background, var(--md-sys-color-surface-container-highest));
|
|
50
|
+
color: var(--input-field-color, var(--md-sys-color-on-surface));
|
|
49
51
|
width: 100%;
|
|
50
52
|
min-height: 200px;
|
|
51
53
|
padding: 12px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label-studio-project-create.js","sourceRoot":"","sources":["../client/label-studio-project-create.ts"],"names":[],"mappings":";AAAA,OAAO,uCAAuC,CAAA;AAC9C,OAAO,qCAAqC,CAAA;AAC5C,OAAO,8CAA8C,CAAA;AACrD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AACzE,OAAO,GAAG,MAAM,aAAa,CAAA;AAGtB,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,QAAQ;IAA/C;;
|
|
1
|
+
{"version":3,"file":"label-studio-project-create.js","sourceRoot":"","sources":["../client/label-studio-project-create.ts"],"names":[],"mappings":";AAAA,OAAO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AAQ,CAAC,IAAI,CAAC,wBAAwB,CAAA;YAEtD,2BAA2B;YAC3B,QAAQ,CAAC,2BAA2B,CAAC,CAAA;QACvC,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAA;YACjD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,IAAI,0BAA0B,CAAA;QAC1D,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,MAAM,GAAG,KAAK,CAAA;QACrB,CAAC;IACH,CAAC;IAED,MAAM;QACJ,QAAQ,CAAC,2BAA2B,CAAC,CAAA;IACvC,CAAC;;AAtIQ;IAAR,KAAK,EAAE;;uDAAmB;AAClB;IAAR,KAAK,EAAE;;6DAAyB;AACxB;IAAR,KAAK,EAAE;;6DAAyB;AACxB;IAAR,KAAK,EAAE;;wDAAwB;AACvB;IAAR,KAAK,EAAE;;uDAAmB;AA7EhB,wBAAwB;IADpC,aAAa,CAAC,6BAA6B,CAAC;GAChC,wBAAwB,CAgNpC","sourcesContent":["import '@material/web/button/filled-button.js'\nimport '@material/web/button/text-button.js'\nimport '@material/web/textfield/filled-text-field.js'\nimport { css, html } from 'lit'\nimport { customElement, state } from 'lit/decorators.js'\nimport { client, PageView, navigate } from '@things-factory/shell/client'\nimport gql from 'graphql-tag'\n\n@customElement('label-studio-project-create')\nexport class LabelStudioProjectCreate extends PageView {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n padding: 20px;\n max-width: 800px;\n margin: 0 auto;\n }\n\n h2 {\n margin: 0 0 20px 0;\n color: var(--md-sys-color-on-surface);\n }\n\n .form-field {\n margin-bottom: 20px;\n }\n\n .form-field label {\n display: block;\n margin-bottom: 8px;\n color: var(--md-sys-color-on-surface);\n font-weight: 500;\n }\n\n md-filled-text-field {\n width: 100%;\n }\n\n textarea {\n background-color: var(--input-field-background, var(--md-sys-color-surface-container-highest));\n color: var(--input-field-color, var(--md-sys-color-on-surface));\n width: 100%;\n min-height: 200px;\n padding: 12px;\n border: 1px solid var(--md-sys-color-outline);\n border-radius: 4px;\n font-family: monospace;\n font-size: 14px;\n resize: vertical;\n }\n\n .actions {\n display: flex;\n gap: 10px;\n justify-content: flex-end;\n margin-top: 20px;\n }\n\n .template-examples {\n margin-top: 20px;\n padding: 15px;\n background: var(--md-sys-color-surface-variant);\n border-radius: 8px;\n }\n\n .template-examples h4 {\n margin: 0 0 10px 0;\n }\n\n .template-btn {\n margin: 5px;\n }\n\n .error {\n color: var(--md-sys-color-error);\n margin: 10px 0;\n }\n `\n ]\n\n @state() title: string = ''\n @state() description: string = ''\n @state() labelConfig: string = ''\n @state() saving: boolean = false\n @state() error: string = ''\n\n render() {\n return html`\n <h2>Create Label Studio Project</h2>\n\n <div class=\"form-field\">\n <label>Project Title *</label>\n <md-filled-text-field\n .value=${this.title}\n @input=${(e: any) => (this.title = e.target.value)}\n placeholder=\"Enter project title\"\n ></md-filled-text-field>\n </div>\n\n <div class=\"form-field\">\n <label>Description</label>\n <md-filled-text-field\n .value=${this.description}\n @input=${(e: any) => (this.description = e.target.value)}\n placeholder=\"Enter project description\"\n ></md-filled-text-field>\n </div>\n\n <div class=\"form-field\">\n <label>Label Configuration (XML) *</label>\n <textarea\n .value=${this.labelConfig}\n @input=${(e: any) => (this.labelConfig = (e.target as HTMLTextAreaElement).value)}\n placeholder='<View> <Text name=\"text\" value=\"$text\"/> <Choices name=\"label\" toName=\"text\"> <Choice value=\"Positive\"/> <Choice value=\"Negative\"/> </Choices> </View>'\n ></textarea>\n </div>\n\n <div class=\"template-examples\">\n <h4>Quick Templates</h4>\n <md-filled-button class=\"template-btn\" @click=${() => this.useTemplate('text-classification')}>\n Text Classification\n </md-filled-button>\n <md-filled-button class=\"template-btn\" @click=${() => this.useTemplate('image-classification')}>\n Image Classification\n </md-filled-button>\n <md-filled-button class=\"template-btn\" @click=${() => this.useTemplate('ner')}>\n Named Entity Recognition\n </md-filled-button>\n </div>\n\n ${this.error ? html`<div class=\"error\">${this.error}</div>` : ''}\n\n <div class=\"actions\">\n <md-text-button @click=${this.cancel}>Cancel</md-text-button>\n <md-filled-button @click=${this.save} ?disabled=${this.saving}>\n ${this.saving ? 'Creating...' : 'Create Project'}\n </md-filled-button>\n </div>\n `\n }\n\n useTemplate(type: string) {\n const templates = {\n 'text-classification': `<View>\n <Text name=\"text\" value=\"$text\"/>\n <Choices name=\"sentiment\" toName=\"text\" choice=\"single\">\n <Choice value=\"Positive\"/>\n <Choice value=\"Negative\"/>\n <Choice value=\"Neutral\"/>\n </Choices>\n</View>`,\n 'image-classification': `<View>\n <Image name=\"image\" value=\"$image\"/>\n <Choices name=\"choice\" toName=\"image\" choice=\"single\">\n <Choice value=\"Cat\"/>\n <Choice value=\"Dog\"/>\n <Choice value=\"Bird\"/>\n </Choices>\n</View>`,\n ner: `<View>\n <Text name=\"text\" value=\"$text\"/>\n <Labels name=\"label\" toName=\"text\">\n <Label value=\"Person\" background=\"red\"/>\n <Label value=\"Organization\" background=\"darkorange\"/>\n <Label value=\"Location\" background=\"blue\"/>\n </Labels>\n</View>`\n }\n\n this.labelConfig = templates[type] || ''\n }\n\n async save() {\n if (!this.title || !this.labelConfig) {\n this.error = 'Title and Label Configuration are required'\n return\n }\n\n try {\n this.saving = true\n this.error = ''\n\n const response = await client.mutate({\n mutation: gql`\n mutation CreateProject($input: CreateProjectInput!) {\n createLabelStudioProject(input: $input) {\n id\n title\n }\n }\n `,\n variables: {\n input: {\n title: this.title,\n description: this.description || undefined,\n labelConfig: this.labelConfig\n }\n }\n })\n\n const project = response.data.createLabelStudioProject\n\n // Navigate to project list\n navigate('label-studio-project-list')\n } catch (error: any) {\n console.error('Failed to create project:', error)\n this.error = error.message || 'Failed to create project'\n } finally {\n this.saving = false\n }\n }\n\n cancel() {\n navigate('label-studio-project-list')\n }\n}\n"]}
|