spina 2.19.0 → 2.20.0

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.

Potentially problematic release.


This version of spina might be problematic. Click here for more details.

Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/spina/manifest.js +2 -2
  3. data/app/assets/javascripts/spina/application.js +1 -1
  4. data/app/assets/javascripts/spina/controllers/confetti_controller.js +1 -1
  5. data/app/assets/javascripts/spina/controllers/data_binding_controller.js +234 -1
  6. data/app/assets/javascripts/spina/controllers/form_controller.js +1 -2
  7. data/app/assets/javascripts/spina/controllers/hotkeys_controller.js +1 -1
  8. data/app/assets/javascripts/spina/controllers/reveal_controller.js +424 -1
  9. data/app/assets/javascripts/spina/controllers/sortable_controller.js +1 -2
  10. data/app/assets/javascripts/spina/libraries/canvas-confetti.js +1 -1
  11. data/app/assets/javascripts/spina/libraries/hotkeys.js +1 -1
  12. data/app/assets/javascripts/spina/libraries/sortablejs.js +1 -1
  13. data/app/assets/javascripts/spina/libraries/trix.js +1 -1
  14. data/app/assets/stylesheets/spina/fonts-propshaft.css +114 -0
  15. data/app/helpers/spina/admin/pages_helper.rb +23 -4
  16. data/app/models/spina/embeds/youtube.rb +1 -1
  17. data/app/views/layouts/spina/admin/application.html.erb +9 -2
  18. data/config/locales/de.yml +2 -0
  19. data/db/migrate/18_change_default_spina_resources_slug.rb +9 -0
  20. data/lib/spina/engine.rb +0 -1
  21. data/lib/spina/railtie.rb +4 -1
  22. data/lib/spina/version.rb +1 -1
  23. metadata +11 -27
  24. data/app/assets/javascripts/spina/libraries/form-request-submit-polyfill.js +0 -1
  25. data/app/assets/javascripts/spina/libraries/form-request-submit-polyfill@2.0.0.js +0 -27
  26. data/app/assets/javascripts/spina/libraries/stimulus-data-bindings@1.3.2.js +0 -234
  27. data/app/assets/javascripts/spina/libraries/stimulus-reveal@1.4.2.js +0 -424
  28. /data/app/assets/stylesheets/spina/{fonts.css.erb → fonts-sprockets.css.erb} +0 -0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spina
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.19.0
4
+ version: 2.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bram Jetten
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-01 00:00:00.000000000 Z
11
+ date: 2025-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,34 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '6.0'
19
+ version: '7.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '8.0'
22
+ version: '9.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '6.0'
29
+ version: '7.0'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '8.0'
33
- - !ruby/object:Gem::Dependency
34
- name: sprockets-rails
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: '0'
40
- type: :runtime
41
- prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: '0'
32
+ version: '9.0'
47
33
  - !ruby/object:Gem::Dependency
48
34
  name: pg
49
35
  requirement: !ruby/object:Gem::Requirement
@@ -134,14 +120,14 @@ dependencies:
134
120
  requirements:
135
121
  - - ">="
136
122
  - !ruby/object:Gem::Version
137
- version: 1.1.3
123
+ version: 1.3.0
138
124
  type: :runtime
139
125
  prerelease: false
140
126
  version_requirements: !ruby/object:Gem::Requirement
141
127
  requirements:
142
128
  - - ">="
143
129
  - !ruby/object:Gem::Version
144
- version: 1.1.3
130
+ version: 1.3.0
145
131
  - !ruby/object:Gem::Dependency
146
132
  name: rack-rewrite
147
133
  requirement: !ruby/object:Gem::Requirement
@@ -1237,19 +1223,16 @@ files:
1237
1223
  - app/assets/javascripts/spina/libraries/canvas-confetti.js
1238
1224
  - app/assets/javascripts/spina/libraries/canvas-confetti@1.3.2.js
1239
1225
  - app/assets/javascripts/spina/libraries/debounce.js
1240
- - app/assets/javascripts/spina/libraries/form-request-submit-polyfill.js
1241
- - app/assets/javascripts/spina/libraries/form-request-submit-polyfill@2.0.0.js
1242
1226
  - app/assets/javascripts/spina/libraries/hotkeys.js
1243
1227
  - app/assets/javascripts/spina/libraries/hotkeys@3.8.7.js
1244
1228
  - app/assets/javascripts/spina/libraries/sortablejs.js
1245
1229
  - app/assets/javascripts/spina/libraries/sortablejs@1.13.0.js
1246
- - app/assets/javascripts/spina/libraries/stimulus-data-bindings@1.3.2.js
1247
- - app/assets/javascripts/spina/libraries/stimulus-reveal@1.4.2.js
1248
1230
  - app/assets/javascripts/spina/libraries/trix.js
1249
1231
  - app/assets/javascripts/spina/libraries/trix@1.3.1.esm.js
1250
1232
  - app/assets/stylesheets/spina/animate.css
1251
1233
  - app/assets/stylesheets/spina/application.tailwind.css
1252
- - app/assets/stylesheets/spina/fonts.css.erb
1234
+ - app/assets/stylesheets/spina/fonts-propshaft.css
1235
+ - app/assets/stylesheets/spina/fonts-sprockets.css.erb
1253
1236
  - app/components/spina/application_component.rb
1254
1237
  - app/components/spina/forms/auto_file_upload_component.html.erb
1255
1238
  - app/components/spina/forms/auto_file_upload_component.rb
@@ -1519,6 +1502,7 @@ files:
1519
1502
  - db/migrate/15_add_slug_to_spina_resources.rb
1520
1503
  - db/migrate/16_add_ancestry_cache_columns_to_spina_pages.rb
1521
1504
  - db/migrate/17_add_custom_urls_to_spina_navigation_items.rb
1505
+ - db/migrate/18_change_default_spina_resources_slug.rb
1522
1506
  - db/migrate/1_create_spina_tables.rb
1523
1507
  - db/migrate/2_create_spina_translation_tables.rb
1524
1508
  - db/migrate/3_create_spina_navigations.rb
@@ -1 +0,0 @@
1
- //= require ./form-request-submit-polyfill@2.0.0.js
@@ -1,27 +0,0 @@
1
- (function(prototype) {
2
- if (typeof prototype.requestSubmit == "function")
3
- return;
4
- prototype.requestSubmit = function(submitter) {
5
- if (submitter) {
6
- validateSubmitter(submitter, this);
7
- submitter.click();
8
- } else {
9
- submitter = document.createElement("input");
10
- submitter.type = "submit";
11
- submitter.hidden = true;
12
- this.appendChild(submitter);
13
- submitter.click();
14
- this.removeChild(submitter);
15
- }
16
- };
17
- function validateSubmitter(submitter, form) {
18
- submitter instanceof HTMLElement || raise(TypeError, "parameter 1 is not of type 'HTMLElement'");
19
- submitter.type == "submit" || raise(TypeError, "The specified element is not a submit button");
20
- submitter.form == form || raise(DOMException, "The specified element is not owned by this form element", "NotFoundError");
21
- }
22
- function raise(errorConstructor, message, name) {
23
- throw new errorConstructor("Failed to execute 'requestSubmit' on 'HTMLFormElement': " + message + ".", name);
24
- }
25
- })(HTMLFormElement.prototype);
26
- export default null;
27
-
@@ -1,234 +0,0 @@
1
- import { Controller } from '@hotwired/stimulus'
2
-
3
- /**
4
- * One way data and visibility bindings for inputs
5
- * @extends Controller
6
- */
7
- export default class DataBindingController extends Controller {
8
- /**
9
- * Initialize bindings on connection to the DOM
10
- */
11
- connect() {
12
- if (this.element.dataset.bindingDebug === "true") {
13
- this.debugMode = true
14
- }
15
-
16
- this._debug("stimulus-data-binding: connecting to wrapper:", this.element)
17
-
18
- const sourceElements = Array.from(this.element.querySelectorAll('[data-binding-target]'))
19
- if (this.element.dataset.bindingTarget) sourceElements.unshift(this.element)
20
-
21
- if (sourceElements.length === 0) this._debug("No source elements found. Did you set data-binding-target on your source elements?")
22
-
23
- for (const sourceElement of sourceElements) {
24
- if (this.debugMode) console.group("stimulus-data-binding: Source element")
25
- this._debug("Source element found", sourceElement)
26
-
27
- if (sourceElement.dataset.bindingInitial !== 'false') {
28
- this._debug("Running initial binding on source element")
29
- this._runBindings(sourceElement)
30
- } else {
31
- this._debug("%cNot running initial binding on source element as binding-initial is set to false", "color: rgba(150,150,150,0.8);")
32
- }
33
-
34
- if (this.debugMode) console.groupEnd()
35
- }
36
- }
37
-
38
- /**
39
- * Updates bindings for the current element.
40
- * @param {Event} e - an event with a currentTarget DOMElement
41
- */
42
- update(e) {
43
- this._runBindings(e.currentTarget)
44
- }
45
-
46
- /**
47
- * @private
48
- * @param {DOMElement} source
49
- */
50
- _runBindings(source) {
51
- this._debug("Searching for targets for source: ", source)
52
- for (const targetRef of source.dataset.bindingTarget.split(' ')) {
53
- const targetElements = this._bindingElements(targetRef)
54
-
55
- if (targetElements.length === 0) this._debug(`Could not find any target elements for ref ${targetRef}. Have you set data-target-ref="${targetRef}" on your target elements?`)
56
-
57
- for (const target of targetElements) {
58
- if (this.debugMode) console.group("stimulus-data-binding: Target Element")
59
- this._debug("Target found. Running bindings for target: ", target)
60
-
61
- const bindingCondition = this._getDatum('bindingCondition', source, target)
62
-
63
- if (bindingCondition) {
64
- this._debug(`Evaluating binding condition: '${bindingCondition}'`)
65
- } else {
66
- this._debug(`%cNo binding condition set. Evaluating as true. To add a condition set 'data-binding-condition="..."'`, "color: rgba(150,150,150,0.8);")
67
- }
68
-
69
- const conditionPassed = this._evaluate(
70
- bindingCondition,
71
- {
72
- source,
73
- target
74
- }
75
- )
76
-
77
- if (conditionPassed) {
78
- this._debug(`Condition evaluated to: `, conditionPassed)
79
- } else {
80
- this._debug(`Condition evaluated to: `, conditionPassed)
81
- }
82
-
83
- const bindingValue = this._getDatum('bindingValue', source, target)
84
-
85
- if (bindingValue) {
86
- this._debug(`Evaluating binding value: '${bindingValue}'`)
87
- } else {
88
- this._debug(`%cNo binding value set, evaluating as true. to set a value for the attribute / property on your target elements set 'data-binding-value="..."'`, "color: rgba(150,150,150,0.8);")
89
- }
90
-
91
- const value = this._evaluate(
92
- bindingValue,
93
- {
94
- source,
95
- target
96
- }
97
- )
98
-
99
- this._debug(`Value evaluated to: '${value}'`)
100
-
101
- const bindingAttribute = this._getDatum(
102
- 'bindingAttribute',
103
- source,
104
- target
105
- )
106
-
107
- if (!bindingAttribute) {
108
- this._debug(`%cNo binding attribute set. To add attributes to your target element set 'data-binding-attribute="..."'`, "color: rgba(150,150,150,0.8);")
109
- }
110
-
111
- if (bindingAttribute) {
112
- for (const attribute of bindingAttribute.split(' ')) {
113
- if (conditionPassed) {
114
- this._debug(`Condition passed so setting attribute '${attribute}' to '${value}'`)
115
- target.setAttribute(attribute, value)
116
- } else {
117
- this._debug(`Condition failed so removing attribute '${attribute}'`)
118
- target.removeAttribute(attribute)
119
- }
120
- }
121
- }
122
-
123
- const bindingProperty = this._getDatum(
124
- 'bindingProperty',
125
- source,
126
- target
127
- )
128
-
129
- if (!bindingProperty) {
130
- this._debug(`%cNo binding property set. To add properties to your target element set 'data-binding-property="..."'`, "color: rgba(150,150,150,0.8);")
131
- }
132
-
133
- if (bindingProperty) {
134
- for (const prop of bindingProperty.split(' ')) {
135
- const propertyValue = conditionPassed ? value : ''
136
- if (target[prop] != propertyValue) { target.dataset.hasChanged = true }
137
-
138
- if (conditionPassed) {
139
- this._debug(`Condition passed so setting property '${prop}' from ${target[prop]} to '${value}'`)
140
- } else {
141
- this._debug(`Condition failed so setting property '${prop}' from ${target[prop]} to '' (empty string)`)
142
- }
143
-
144
- target[prop] = propertyValue
145
- }
146
- }
147
-
148
- const bindingClass = this._getDatum(
149
- 'bindingClass',
150
- source,
151
- target
152
- )
153
-
154
- if (!bindingClass) {
155
- this._debug(`%cNo binding class set. To add classes to your target element set 'data-binding-class="..."'`, "color: rgba(150,150,150,0.8);")
156
- }
157
-
158
- if (bindingClass) {
159
- for (const klass of bindingClass.split(' ')) {
160
- if (conditionPassed) {
161
- this._debug(`Condition passed so adding class '${klass}'`)
162
- target.classList.add(klass)
163
- } else {
164
- this._debug(`Condition failed so removing class '${klass}'`)
165
- target.classList.remove(klass)
166
- }
167
- }
168
- }
169
-
170
- const bindingEvent = this._getDatum('bindingEvent', source, target)
171
-
172
- if (!bindingEvent) {
173
- this._debug(`%cNo binding event set. To dispatch events on property change to your target element set 'data-binding-event="..."'`, "color: rgba(150,150,150,0.8);")
174
- }
175
-
176
- if (bindingEvent) {
177
- for (const event of bindingEvent.split(' ')) {
178
- if (target.dataset.hasChanged) {
179
- this._debug(`Target has changed so dispatching event ${event}`)
180
- target.dispatchEvent(new Event(event, { cancelable: true, bubbles: true }))
181
- delete target.dataset.hasChanged
182
- } else {
183
- this._debug(`No changes to target properties so not dispatching '${event}'`)
184
- }
185
- }
186
- }
187
-
188
- if (this.debugMode) console.groupEnd()
189
- }
190
- }
191
- }
192
-
193
- /**
194
- * @private
195
- * @param {String} name - the name of the binding reference
196
- */
197
- _bindingElements(name) {
198
- return this.element.querySelectorAll(`[data-binding-ref="${name}"]`)
199
- }
200
-
201
- /**
202
- * @private
203
- * @param {String} attribute - the attribute to fetch from the source / target dataaset
204
- * @param {String} source - The source element to get the attribute from, only loads if target doesnt have it
205
- * @param {String} target - The target element to get the attribute from, has precedence over the source
206
- */
207
- _getDatum(attribute, source, target) {
208
- return target.dataset[attribute] || source.dataset[attribute]
209
- }
210
-
211
- /**
212
- * @private
213
- * @param {String} expression - expression to safe eval
214
- * @param {Object} variables - variables to be present when evaluating the given expression
215
- */
216
- _evaluate(expression, variables = {}) {
217
- if (!expression) return true
218
- return new Function(
219
- Object.keys(variables).map((v) => `$${v}`),
220
- `return ${expression.trim()}`
221
- )(...Object.values(variables))
222
- }
223
-
224
- /**
225
- * @private
226
- * @param {String} expression - expression to safe eval
227
- * @param {Object} variables - variables to be present when evaluating the given expression
228
- */
229
- _debug(...args) {
230
- if (this.debugMode) {
231
- console.log(...args)
232
- }
233
- }
234
- }