Skip to content

Commit 59e1870

Browse files
committed
fix: errors in html templates and css styles
1 parent b97950e commit 59e1870

File tree

8 files changed

+22
-23
lines changed

8 files changed

+22
-23
lines changed

package.json

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
"plugin"
1414
],
1515
"main": "dist/index.js",
16-
"type": "module",
17-
"exports": {
18-
".": "./dist/index.js"
19-
},
2016
"types": "dist/index.d.ts",
2117
"files": [
2218
"dist",
@@ -52,18 +48,18 @@
5248
},
5349
"devDependencies": {
5450
"@babel/preset-env": "^7.26.9",
55-
"@eslint/js": "^9.25.0",
51+
"@eslint/js": "^9.25.1",
5652
"@types/jest": "^29.5.14",
5753
"babel-jest": "^29.7.0",
58-
"eslint": "^9.25.0",
54+
"eslint": "^9.25.1",
5955
"grapesjs-cli": "^4.1.3",
6056
"http-server": "^14.1.1",
6157
"husky": "^9.1.7",
6258
"jest": "^29.7.0",
6359
"jest-environment-jsdom": "^29.7.0",
6460
"ts-jest": "^29.3.2",
6561
"typescript": "^5.8.3",
66-
"typescript-eslint": "^8.30.1"
62+
"typescript-eslint": "^8.31.0"
6763
},
6864
"dependencies": {
6965
"@silexlabs/expression-input": "^0.0.28",

src/components/complex-selector.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import InlineSelectComponent from './inline-select'
99
import CompoundSelectorComponent from './compound-selector'
1010
import { CompoundSelector } from '../model/CompoundSelector'
1111
import { FOCUS_VISIBLE } from '../styles'
12+
import './inline-select'
13+
import './compound-selector'
1214

1315
/**
1416
* A component to display and edit a complex selector

src/components/compound-selector.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import SimpleSelectorComponent from './simple-selector'
77
import { PSEUDO_CLASSES } from '../model/PseudoClass'
88
import { FOCUS_VISIBLE } from '../styles'
99
import './inline-select'
10+
import './simple-selector'
1011

1112
/**
1213
* A component to display and edit a compound selector

src/components/current-selector-display.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class CurrentSelectorDisplay extends StylableElement {
4545
static override styles = css`
4646
:host {
4747
${ FOCUS_VISIBLE }
48-
:host {
48+
& {
4949
font-size: 0.65rem;
5050
padding: 0.5rem 0;
5151
}

src/components/inline-select.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { css, html, TemplateResult } from 'lit'
44
import { PseudoClass } from '../model/PseudoClass'
55
import { Operator } from '../model/Operator'
66
import { createRef, ref } from 'lit/directives/ref.js'
7-
import './resize-input'
87
import { customizeInput, customizeSelect, FOCUS_VISIBLE } from '../styles'
8+
import './resize-input'
99

1010
type Option = PseudoClass | Operator
1111

@@ -39,6 +39,12 @@ export default class InlineSelectComponent extends StylableElement {
3939
static override styles = css`
4040
:host {
4141
${ FOCUS_VISIBLE }
42+
& {
43+
display: block;
44+
text-align: left;
45+
padding: 0 0.5rem;
46+
margin: 0.5rem 0;
47+
}
4248
button:hover, a:hover {
4349
transform: translateY(1px);
4450
color: var(--gjs-primary-color, #333);
@@ -50,12 +56,6 @@ export default class InlineSelectComponent extends StylableElement {
5056
margin: 0;
5157
padding: 0;
5258
}
53-
:host {
54-
display: block;
55-
text-align: left;
56-
padding: 0 0.5rem;
57-
margin: 0.5rem 0;
58-
}
5959
section {
6060
display: flex;
6161
justify-content: space-between;

src/components/simple-selector.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { AttributeSelector, SimpleSelector, SimpleSelectorSuggestion, toString,
55
import StylableElement from '../StylableElement'
66
import { createRef, ref } from 'lit/directives/ref.js'
77
import { customizeInput, customizeSelect, FOCUS_VISIBLE } from '../styles'
8+
import './resize-input'
89

910
export default class SimpleSelectorComponent extends StylableElement {
1011

src/index.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
// Web components
2-
import './components/simple-selector.ts'
3-
import './components/inline-select.ts'
4-
import './components/compound-selector.ts'
5-
import './components/complex-selector.ts'
6-
import './components/current-selector-display.ts'
7-
81
// GrapesJs Plugin
92
import { AdvancedSelectorOptions, initASM, initListeners } from './plugin'
103
import { Editor } from 'grapesjs'
114
import en from './i18n/en'
125
import fr from './i18n/fr'
6+
7+
// For devtools debugging
8+
export const name = '@silexlabs/grapesjs-advanced-selector'
9+
1310
export default (editor: Editor, opts: Partial<AdvancedSelectorOptions> = {}) => {
1411
// Defaults
1512
const options = {

src/plugin.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { html, render } from 'lit'
33
import { clearStyle, editStyle, getComponentSelector, getSelectedStyle, getSelectors, getSuggestionsMain, getSuggestionsRelated, getTranslation, getUntranslatedKeys, matchSelectorAll, matchSelectorSome, renameSelector, setComponentSelector, setSelectedStyle } from './model/GrapesJsSelectors'
44
import { activateSelectors, ComplexSelector, EMPTY_SELECTOR, merge, same, toString } from './model/ComplexSelector'
55
import { IdSelector, SimpleSelectorType } from './model/SimpleSelector'
6+
import './components/complex-selector'
7+
import './components/current-selector-display'
68

79
////////////////
810
// Types
@@ -83,7 +85,7 @@ function updateUi(editor: Editor, options: AdvancedSelectorOptions) {
8385
8486
<current-selector-display
8587
.t=${(key: string) => getTranslation(editor, key)}
86-
.value=${getSelector(components)}
88+
.value=${getSelector(components) || undefined}
8789
.selectors=${getSelectors(editor)}
8890
.helpLink=${options.helpLinks.actionBar}
8991
.error=${getTranslation(editor, errors || '')}

0 commit comments

Comments
 (0)