Skip to content

Commit

Permalink
feat(build): provide un-bundled element by default (bundled version s…
Browse files Browse the repository at this point in the history
…till available in dist folder) (#1065)

* build: remove minify and optimization for drawtools and geosearch

* build: update output structure to reflect src structure

* fix: update drawtools import in agri e2e test

* fix: use src folder for npm package, without any vite intervention

* add: elements-styles package

* chore: revert drawtools vite config

* fix: revert geosearch vite config

* fix: update agri e2e import

* fix: serve e2e test with vite

* chore: update package lock

* chore(test): clean up e2e test setup

* chore: remove old e2e tests

* chore(deps): link elements-utils package

* chore(deps): adding peer dependencies

* chore: add src folder to published package, set src/main as main entry file

* chore(deps): remove glob package

* chore: remove test folders from published packages

* chore: use package imports instead of relative links in preview.js

* chore(docs): changes for plugin import, explain dist bundle

* chore: update package.json

---------

Co-authored-by: silvester-pari <[email protected]>
  • Loading branch information
radupasparuga and silvester-pari authored Oct 17, 2024
1 parent e88e875 commit 333e324
Show file tree
Hide file tree
Showing 49 changed files with 1,768 additions and 3,854 deletions.
24 changes: 12 additions & 12 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import { setCustomElementsManifest } from "@storybook/web-components";
import customElements from "../custom-elements.json";
import DocumentationTemplate from "./DocumentationTemplate.mdx";

import "../elements/chart/src/main.js";
import "../elements/drawtools/src/main.js";
import "../elements/geosearch/src/main.js";
import "../elements/itemfilter/src/main.js";
import "../elements/jsonform/src/main.js";
import "../elements/layercontrol/src/main.js";
import "../elements/layout/src/main.js";
import "../elements/map/src/main.js";
import "../elements/map/src/plugins/advancedLayersAndSources/index";
import "../elements/stacinfo/src/main.js";
import "../elements/storytelling/src/main.js";
import "../elements/timecontrol/src/main.js";
import "@eox/chart";
import "@eox/drawtools";
import "@eox/geosearch";
import "@eox/itemfilter";
import "@eox/jsonform";
import "@eox/layercontrol";
import "@eox/layout";
import "@eox/map";
import "@eox/map/src/plugins/advancedLayersAndSources";
import "@eox/stacinfo";
import "@eox/storytelling";
import "@eox/timecontrol";

/**
* A custom wrapper for the default setCustomElementsManifest function.
Expand Down
80 changes: 0 additions & 80 deletions cypress/e2e/agri.cy.js

This file was deleted.

45 changes: 0 additions & 45 deletions cypress/e2e/agri.html

This file was deleted.

4 changes: 4 additions & 0 deletions elements/chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ npm install @eox/chart
```

```
// for setups with bundlers e.g. Vite
import "@eox/chart"
// or, for e.g. single HTML files without bundler
import "@eox/chart/dist/eox-chart.js"
<eox-chart></eox-chart>
```

Expand Down
5 changes: 3 additions & 2 deletions elements/chart/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
},
"files": [
"dist",
"test"
"src"
],
"main": "./dist/eox-chart.js",
"main": "./src/main.js",
"scripts": {
"build": "vite build",
"watch": "vite build --watch"
},
"dependencies": {
"@eox/elements-utils": "^0.0.1",
"deepmerge-ts": "^7.1.3",
"lit": "^3.0.2",
"vega": "^5.30.0",
Expand Down
2 changes: 1 addition & 1 deletion elements/chart/src/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { LitElement, html } from "lit";
import { style } from "./style";
import { styleEOX } from "./style.eox";
import allStyle from "../../../utils/styles/dist/all.style";
import allStyle from "@eox/elements-utils/styles/dist/all.style";
import { renderChartMethod } from "./methods/render";

/**
Expand Down
4 changes: 4 additions & 0 deletions elements/drawtools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ npm install @eox/drawtools
```

```
// for setups with bundlers e.g. Vite
import "@eox/drawtools"
// or, for e.g. single HTML files without bundler
import "@eox/drawtools/dist/eox-drawtools.js"
<eox-drawtools></eox-drawtools>
```

Expand Down
5 changes: 3 additions & 2 deletions elements/drawtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
},
"files": [
"dist",
"test"
"src"
],
"main": "./dist/eox-drawtools.js",
"main": "./src/main.js",
"scripts": {
"build": "vite build",
"watch": "vite build --watch"
},
"dependencies": {
"@eox/elements-utils": "^0.0.1",
"lit": "^3.0.2"
}
}
4 changes: 2 additions & 2 deletions elements/drawtools/src/components/controller.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { LitElement, html, nothing } from "lit";
import { updateButtonStatesMethod } from "../methods/controller";
import buttonStyle from "../../../../utils/styles/dist/button.style";
import inputStyle from "../../../../utils/styles/dist/input.style";
import buttonStyle from "@eox/elements-utils/styles/dist/button.style";
import inputStyle from "@eox/elements-utils/styles/dist/input.style";
import { copyTextToClipboard } from "../helpers/index.js";
import { when } from "lit/directives/when.js";

Expand Down
2 changes: 1 addition & 1 deletion elements/drawtools/src/components/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
hoverFeatureMethod,
selectAndDeselectFeatureMethod,
} from "../methods/list";
import listStyle from "../../../../utils/styles/dist/list.style";
import listStyle from "@eox/elements-utils/styles/dist/list.style";

/**
* Display list of features
Expand Down
2 changes: 1 addition & 1 deletion elements/drawtools/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
discardDrawingMethod,
emitDrawnFeaturesMethod,
} from "./methods/draw";
import mainStyle from "../../../utils/styles/dist/main.style";
import mainStyle from "@eox/elements-utils/styles/dist/main.style";
import { DUMMY_GEO_JSON } from "./enums/index.js";
import {
initMapDragDropImport,
Expand Down
2 changes: 1 addition & 1 deletion elements/drawtools/src/methods/draw/init-layer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { onDrawEndMethod } from "./";

import { getElement } from "../../../../../utils";
import { getElement } from "@eox/elements-utils";

/**
* Initializes the draw layer, interacts with the map, and returns map instances.
Expand Down
26 changes: 25 additions & 1 deletion elements/geosearch/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
# EOxGeoSearch
# Geo Search

An autocompleted search input for geographic locations.

The element comes with a configurable button mode which can be enabled with the boolean attributes `button` and, additionally, `small`, to use the button in a map toolbar.

Real-time OpenCage API access is enabled by setting the `endpoint` attribute. Optionally, a `limit` attribute may be set to restrict the number of fetched locations.

## Usage

```
npm install @eox/geosearch
```

```
// for setups with bundlers e.g. Vite
import "@eox/geosearch"
// or, for e.g. single HTML files without bundler
import "@eox/geosearch/dist/eox-geosearch.js"
<eox-geosearch></eox-geosearch>
```

## Configuration

Furthermore, the alignment of the input and search results can be configured to align straight or in a 90-degree angle in any direction with the `input-direction` and `results-direction` attributes and the following directions:
Expand All @@ -28,3 +44,11 @@ To style the component, the following CSS variables are supported:
## Screenshots/Videos

![Screen Recording 2024-05-21 at 12 11 02](https://github.com/EOX-A/EOxElements/assets/94269527/5d207fbb-6abf-42d5-b053-74ad4e75f930)

## Development

For a development setup, please check the [root-level readme](../../README.md).

## Changelog

Created automatically [here](./CHANGELOG.md)
9 changes: 5 additions & 4 deletions elements/geosearch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"name": "@eox/geosearch",
"version": "0.3.0",
"type": "module",
"main": "./dist/eox-geosearch.js",
"engines": {
"npm": ">=8.0.0",
"node": ">=18.0.0"
},
"files": [
"dist",
"test"
"src"
],
"main": "./src/main.js",
"scripts": {
"build": "vite build",
"watch": "vite build --watch"
Expand All @@ -21,8 +21,9 @@
"vite": "^5.2.11"
},
"dependencies": {
"@eox/elements-utils": "^0.0.1",
"lit": "^3.1.3",
"proj4": "^2.11.0",
"lodash.debounce": "^4.0.8"
"lodash.debounce": "^4.0.8",
"proj4": "^2.11.0"
}
}
6 changes: 3 additions & 3 deletions elements/geosearch/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { unsafeSVG } from "lit/directives/unsafe-svg.js";
import proj4 from "proj4";
import _debounce from "lodash.debounce";

import mainStyle from "../../../utils/styles/dist/main.style";
import buttonStyle from "../../../utils/styles/dist/button.style";
import mainStyle from "@eox/elements-utils/styles/dist/main.style";
import buttonStyle from "@eox/elements-utils/styles/dist/button.style";
import { styleEOX } from "./style.eox";

import { getElement } from "../../../utils/getElement";
import { getElement } from "@eox/elements-utils";

const loaderSvg = `
<svg
Expand Down
1 change: 0 additions & 1 deletion elements/geosearch/src/style.eox.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { css } from "lit";
// import { button } from "../../utils/styles/button";

export const styleEOX = css`
.geosearch {
Expand Down
4 changes: 4 additions & 0 deletions elements/itemfilter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ npm install @eox/itemfilter
```

```
// for setups with bundlers e.g. Vite
import "@eox/itemfilter"
// or, for e.g. single HTML files without bundler
import "@eox/itemfilter/dist/eox-itemfilter.js"
<eox-itemfilter></eox-itemfilter>
```

Expand Down
8 changes: 6 additions & 2 deletions elements/itemfilter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
},
"files": [
"dist",
"test"
"src"
],
"main": "./dist/eox-itemfilter.js",
"main": "./src/main.js",
"scripts": {
"build": "vite build",
"watch": "vite build --watch"
},
"dependencies": {
"@eox/elements-utils": "^0.0.1",
"@floating-ui/dom": "^1.6.8",
"@turf/boolean-intersects": "^7.0.0",
"@turf/boolean-within": "^7.0.0",
Expand All @@ -30,5 +31,8 @@
"lodash.flatmap": "^4.5.0",
"lodash.uniq": "^4.5.0",
"toolcool-range-slider": "^4.0.27"
},
"peerDependencies": {
"@eox/map": "^1.15.0"
}
}
Loading

0 comments on commit 333e324

Please sign in to comment.